I recently got a Verizon S7 in pretty good shape other than a small crack in the corner of the front glass and I've noticed that every morning I wake up and unlock the phone and without fail it'll be on the "App Info" screen for a completely random app. I clear the app switcher before I go to bed and I clear the cache every couple days yet despite this and the phone being passcode / fingerprint protected it's still doing things when I'm not touching it. (the phone is running Android 8.0 with the last S7 security patch)
The phone may be using the crack as a touch input. On a display with no crack, the screen is searching for variances so that it can accurately reflect your input. With a crack, it's doing the same thing except now it's constantly getting a signal from a part of the screen.
I would try using the device in Safe Mode, if the symptom goes away, it is likely an app causing this. If it does not go away in Safe Mode, you can try a factory reset but the issue is likely hardware.
To enter Safe Mode:
There's only one crack over the display itself but it seems weird that it would be accepting touch with the screen off and locked. Plus it never has weird touch input glitches when I'm using it and it always opens app info, never anything else