Ok. Always one of the first steps.
I tried a google of “iPhone stuck in headphone mode” and that came back with a lot of suggestions/ hits. You may have done that already, but it is my only other thought at present, bar a trip to an Apple retailer, which may not be convenient.
Hopefully other suggestions will appear here shortly.