When you play audio and no sound comes out of your iPhone, but a notification appears on the screen indicating the volume of your headphones, even though no headphones are connected, your smartphone thinks you are still connected to the headphones.
How to Fix iPhone Stuck in Headphone Mode
This problem is not very common and in most cases it is easy to solve.
Plugging and unplugging headphones. The first thing to try if your iPhone thinks you have headphones plugged in is simple: plugging and unplugging your headphones. It’s possible that the headphone jack on your iPhone didn’t recognize the last time you unplugged your headphones and it still thinks they’re plugged in.
If this trick fixes the problem and the situation doesn't happen regularly, then it's a strange, one-time occurrence and you don't need to worry.