In my car I put my phone down in my center console. It only covers the top portion of the phone. If I go to touch the phone it tells me that there's an accidental touch do you actually want to turn the screen on or whatever.
Every phone that I've had, including my ZTE AXON 10 pro, has a sensor right at the top. When you covered the phone at the top, the screen would go blank.