This is surprising, never faced this issue even on my iPhone 8 with a non functioning proximity sensor. I say bugs, but shouldn’t everyone have it? Check if your phone screen turns off on a phone call when you cover the earpiece. If it’s not going black, that’s a defective proximity sensorYet it keeps on happening, even after factory reset. Also, its not always an option to put the phone face down... on a charging pad for example.
Back in the day of iOS 3 or 4, these things just didn't happen because to unlock I always had to do a swipe first. Even when a notification just arrived. I would love to get that option back.