The following it just to determine if it may be a software problem or if it is a hardware problem.
Try starting the phone in safe mode and check if the problem is still there.
If it is not there then a downloaded app is the cause of the problem. You will need to uninstall the downloaded apps, one by one and test the phone in normal mode until it tests OK. When it does test OK the last downloaded app that was uninstalled was the culprit.
If it is still there when in safe mode reset the phone using the phone’s factory restore feature and check if the problem is still there or not.
Be aware that a factory restore (aka factory reset, hard reset) will erase all your data and downloaded apps. It will restore the phone to its’ default or last system updated operating system, so backup the phone to a computer or the cloud, using the phone’s backup feature, before performing the reset.
Once the backup has been completed, reset the phone using the phone’s factory restore feature. You may need to remember or write down the phone’s Google account user name and password before you reset the phone as you might need it once the phone has been reset
Once it has been reset to factory default check if the problem is still there.
If it is still there then there is a hardware problem. The phone would have to be opened and the problem further diagnosed, most probably by temporarily replacing the screen to check if the problem is a screen problem or a systemboard problem.
If it is not there then using the backup that you made earlier, restore the phone using the phone’s restore feature.
Once the phone has been restored to what it was, check that it is still testing OK. If it is then the reset has resolved the problem.