I was having the same issue, what fixed it for me was this:
On the storyboard, for your Navigation Controller change the "Bar Tint" to its "Default" value, then on your code you can change it as you normally would.
// For the navigation bar
navigationController?.navigationBar.barTintColor = .red
// For the title
let attributes = [NSAttributedString.Key.foregroundColor: UIColor.white ]
navigationController?.navigationBar.titleTextAttributes = attributes

I have the code in viewDidLoad()

Oddly enough for me, it also fixed the issue I was having with the "Status Bar".