Most devices have at least 2 mics, one on the bottom and one on the top or back. The one on the bottom is obviously for when you hold the phone up to your ear, the other one usually comes into play when you voice record, talk on speakerphone or record video. Have you tried recording video to see if there is sound? Have you tried making a voice recording or talking to Google Assistant to see if it responds? It's possible that the mic is damaged but it is also possible that the mic is being used by another app. Start the device in "Safe Mode" and make a test call. If you find that it works in safe mode then you most likely have a bad app.
To solve for a bad app go into Settings>Apps, open the menu select permissions, then go into Microphone and take permission away from everything except the phone. Then as you use apps they will request permission to access your mic at which time you can check to see if your phone still works after granting permission. When you give permission and then find out that your mic isn't working you'll know that was the app and can decide then how you want to deal with it.
If nothing works I'd recommend that you take it to your carrier's repair center.