If connecting and disconnecting your headphones didn't work, you should clean your iPhone's port (headphone jack, Lightning, ...
If you own an iPhone, you've probably used it to listen to music through headphones on your commute home from work, or while using the treadmill at the gym. And generally, as soon as you unplug ...