iPhone turns off display whenever covering the proximity sensor
There are several reasons why this may be happening:


You have a case or screen protector that interferes with the proximity sensor. If so then try to remove them.
Do a force restart of your device. Press and hold both the Side and Volume Down buttons for at least 10 seconds, until you see the Apple logo. 


If that doesn't work then take your iPhone to an Apple Store.