Your ability to hear someone has no connection to whether someone else can hear you. When you're listening on your phone you're using the earpiece speaker, but when talking the lower microphone is where the sound goes.
The most likely culprit for your issue is that microphone. It's common for the opening or mesh to get clogged with pocket lint or dirt, muting your voice and making it hard to hear for others. Cleaning the microphone opening will usually clear up the problem it that's the issue; you may need to use some isopropyl alcohol with a brush or a tissue, or possibly compressed air or a vacuum, depending on how your microphone port is set up. Here's a picture from the users manual showing the location of that lower microphone.
Do be careful when cleaning, as the manual has a caution regarding it.
If dust or foreign materials enter the microphone, speaker, or receiver, or if these parts are covered, the device’s sound may become quiet or certain features may not work. If you attempt to remove the dust or foreign materials with a sharp object, the device may be damaged and its appearance may be affected.
If cleaning the port doesn't do the job, the microphone itself may be defective or damaged and need to be replaced. On your phone it's located on a replaceable daughter board that's not too difficult to swap out. Here's where it is located.
Luckily, if it comes down to that, iFixit has a guide showing you exactly what you would have to do to replace that daughter board.
Samsung Galaxy A15 USB-C Charging Port and Daughterboard Replacement - iFixit Repair Guide
So the most likely fix is to clean or replace the lower microphone and now you have all the information you should need to do either one. For the benefit of the rest of the repair community, be sure to come on back and let us know how it all turns out and what worked to fix the problem, or if neither thing helps and you need more suggestions.