iPhone 8 randomly locks the screen while I'm using it Sometimes when I'm actively using the phone the lock screen pops up and I have to unlock.

145 others have upvoted this problem at https://discussions.apple.com/thread/8127644 . I tried the only suggestion, which was to set the time to the past just before upgrading iOS, but the problem persists. I'm on 11.3 now.

Help?

Any logs I can look at to get a clue?
How often does this occur throughout the day or week? 

Try to backup your iPhone and then restore it with iTunes. Once you get a chance to setup the iPhone then restore from the backup and then test the phone again. Usually this is a software glitch.

If it occurs afterwards do the restore again and don't restore your backup this time. Use the phone without the backup to test the issue. If its still present then it is a hardware sensor issue.