1. Can you talk on calls? The other party can hear you? If so the microphone is actually working.
That would mean the problem is an app. To try and resolve that...
1. Restart the phone. It may be that simple to fix.
2. Open that app (whatever app you are using) and go into the apps "Settings". Make sure the speech option (rather than typing) is on.
3. Should this not work, you may well need to uninstall the app, restart the phone and then reinstall the app. Just be sure you save anything that is in the app that you want to keep first.