Check to see that these conditions have been met. Reset Apple ID password at https://support.apple.com/apple-id. You’ll have to meet all of the Apple requirements. I would recommend that you do not change the status of two-factor verification at this time if you’re able to continue the verification of the Apple ID.
Once you are sure that the Apple ID is once again completely usable with name and password, then you can sign out of your non-working instance of the Apple ID account on the iPhone. The only contraindication for this would be if your device is too full to accept software updates (as required in the subsequent steps for signing back in). If you have that problem, some stuff may have to be deleted to make room for the update. That’s not too likely, though, so I’d go ahead and sign out.
I would recommend that you keep any data that it asks about deleting, then allow the data to be merged when you sign back in.
You can completely reset the device if you desire, but I wouldn’t recommend that unless you aren’t able to get signed back in any other way.
Here’s how to sign out.
https://support.apple.com/en-us/HT208242
Here are instructions for signing back into the iPhone:
https://support.apple.com/en-us/HT208681#ios