Try starting the phone in safe mode and make or receive a call just to check that it is not a downloaded app that is causing the problem. If it works OK in safe mode the trick is to find out which downloaded app is the culprit.
If it still doesn’t work OK in safe mode it may be that the ear speaker is either loose or faulty.
Try just gently (stress very gently) squeezing either side of the phone where the ear speaker is situated between the thumb and forefinger and check if this restores its’ function. Do this with the phone turned off and the battery removed to safeguard against any potential problems ;-).
If that doesn’t work here’s a link to the ifixit Samsung Galaxy J3 (2016) guides which should help to give you access to the speaker.
Here’s a link to just one supplier of the part.
It is only shown to give you an idea of what it looks like and what the cost of the part is. There are other suppliers online that may suit you better.Just search for Samsung Galaxy J3 2016 ear speaker to get results.