I had this same exact issue on my earlier A50, which I took to the shop and they got it working after they apparently replaced the microphone, but it then appeared couple of months later. I then got the A51 and after about 9 or so months later, I'm facing the exact same issue.
I haven't broken my phone by dropping it or coming into contact with extreme temperatures or have I rooted my phone and broken something that way.
I factory reset the phone yesterday and kinda got the mic working, because at least Google assistant recognized my voice. But today again, it can barely recognize my voice. It'll hear some words (and I emphasize some), but only if I yell directly into the lower mic, or if I blow into the mic or start tapping onto the phone.
I don't feel like taking the phone to the repair shop again because it'll break once again. Is there anything else I can do?
Edit: I managed to solve it. The upper and lower microphones were covered with gunk, which I scratched off with toothpicks. I don't think I managed to get all of it out, especially from the upper microphone since the grid has some visible light blockage, but I'm able to hear my voice again with a voice recorder and don't need to yell 2cm away from the mic.
I don't get why Samsung doesn't have some guidelines for getting rid of any blockage.