You may be using different software version, maybe they fixed it. It was very popular model, I really doubt if it had such serious issues it would not be fixed.
But considering not all people have this problem it's either software error, software setting or some batches had hardware issue or they fixed the design.
I found guy reporting it as software issue: https://www.reddit.com/r/galaxys10/comments/bzv9oq/proximity...
though other says it's faulty design https://www.reddit.com/r/galaxys10/comments/d94ob7/proximity...
Samsung recommended to return the phone, some people had luck with changing Touch sensitivity settings and Accidental touch protection https://piunikaweb.com/2019/03/18/samsung-galaxy-s10-proximi...
possible to test it here to see whether it's hardware or software issue https://forum.xda-developers.com/t/the-proximity-sensor-is-n...
But considering not all people have this problem it's either software error, software setting or some batches had hardware issue or they fixed the design.