What phone do you have? Any recent phone I’ve had should have an accidental touch setting you can enable, it bases off of the light level going into the camera I believe.
If the phone is in your pocket or the room is dark you need to swipe a lock icon to unlock the screen.
Breaking News: Massive uptick in cyber attacks targeting "CEOs" of hit MMORPG "Eve Online" to steal virtual financial information, more at 10.