Try inserting the headphones with the microphone attachment accessory into the headphone socket and then either make or receive a call to determine that you can both hear and be heard.
If you can it proves that the phone is working correctly and all that has happened is that the contact in the headphone socket, which informs the audio controller that the headphones have been inserted, has got stuck in the operated position.
You could try gently inserting and removing the headphone plug a few times (gently wiggle it from side to side when it is inserted- stress gently) to see if this will free the contact. You will know it is free when the headphone icon has gone from the screen with the plug removed.
If this doesn't work then the phone will have to be opened and the headphone socket will have to be replaced as it is faulty.
Here is a link to a video which shows how to dis-assemble the phone. At 2:29 minutes into the video the headphone socket is clearly visible on the systemboard.
Because it is a SMD (Surface Mounted Device) removing the socket and replacing it with a new one is not a job for novices. You will need to have the requisite skill and tools to perform the work. You can cause more problems than what you had before you started if you do not know how to do this.
I recommend that you contact a reputable, professional mobile phone repair service and ask for a quote to repair the phone.