Fix iPhone Ear Speaker Issue : How to Troubleshoot, Recommended Solutions
Apple Articles: 4 Fixes If Your iPhone Ear Speaker Is Not Working
Check Sound Settings
Settings>
Sounds & Haptics>Ringer and Alerts Alert >Volume If you do not hear sound, or the speaker button is grayed out, your speaker may need service.
Clean the Speaker Grill
Carefully brush off any dirt on the ear speaker grill with a really soft bristle. A blow of compressed air can be beneficial against particles.
Disable Noise Cancellation
In some situations, simply disabling Phone Noise Cancellation under Settings > Accessibility > Audio/Visual could fix an ear speaker problem.
Update iOS
Your iPhone will sometimes be automatically updated but check that it has the most recent iOS update as many include fixes for issues related to audio.
Reset All Settings
Finally, you may need to try Reset All Settings before getting help from Apple Support. This will not delete anything apart from settings.
If the above techniques fail then you may have to take it in for professional repair. You may want to use a refurbished iPhone (ad)(ad) until getting yours fixed.