Try installing this AIDA64 app, it's a utility that just summarizes your phone's hardware and software.
https://play.google.com/store/apps/details?id=com.finalwire.aida64&hl=en_US
Start the app and tap on 'Sensors', and wait a few seconds for it to access thing. There should be a Proximity sensor in the resulting listing. On the phone I'm looking at it only shows two conditions - 100 cm and 3 cm (the former holding the phone out, the latter when I hold my hand close to the approximate sensor location). Your numbers will probably vary.
You mentioned sending your phone back in again to the problem fixed, but could you provide more details as to just what was done as far as, "...they've fitted in a new one..."? Only on some models (very few) different sensors might be modular (therefore more easily replaceable) but for the most part most of them are soldered directly to the circuit boards. With most smartphone models, replacing a failed component is usually a matter of replacing the entire motherboard. With something like the Proximity sensor, it does need to be outward facing exposure and replacing the display typically requires a complete tear-down of the phone so while there is a chance the sensor itself was damaged in the process, it's also more likely to be just a bad alignment issue (the sensor now isn't lining up with the viewing opening internally.)
Or do you have your P30 in a case? Could it just be a matter of the phone has shifted out of place and part of the case is blocking the sensor?
Do you know if your phone was phone repaired at a local shop or was it sent out to the manufacturer?