If this is during speakerphone use I don't think this can be prevented. Ever since (at least) the Note 8, this has been a "feature". There have been multiple threads and multiple suggestions made but I have never seen anyone report success.
There are more than one app in playstore with name Screen On. Do you know the name of the company it comes from?
The app name is called "screen on". And yes it works with android 10