Though this is not at all a question for this platform but try cleaning your headphone port on your phone. I’ve been through similar situation. It can be dust otherwise water. Try drying the phone with blow dryer 🙂
solved How do i Reset the headset icon in my phone Programmatically [closed]