This occurs either by a faulty screen or a screen that is installed on a iPhone metal frame that is pushing against the screen causing it to flex.
If your screen can push down noticably due to dented frame then this may cause the touch screen to not work properly causing ghost touching or stops working after a bit until you turn the screen off and on again.
This is why I always have a spare screen to test fit first then bend the frame to make the screen sit as flush as possible. Then put the other replacement screen on to make sure I don't get touch screen issues like this.