The headphone jack problem is one of the most common issues the users have to face in mobile phones. There are a lot of ways through which you may be able to sort this matter.
https://wilderzayn.wordpress.com/2020/07/31/how-to-fix-problems-with-your-iphone-headphone-jack/
https://sortmcafee.com/activate/