I've seen a few iPhones with vertical lines over the years, but can't recall if I've ever seen one with horizontal lines.
Firstly, just to get this out of the way, I assume this is the original screen? I have seen strange behaviour such as this when non-genuine screens have been used. If you have a non-genuine screen, this could very well be your problem.
Assuming it is a genuine screen, the first thing to try (because it's easy to do) is a full reboot of your phone. By this I mean simultaneously holding down the power and Home buttons until you see the Apple logo on your screen.
If a full reboot doesn't work, then the next thing to try is to manually do a full backup of your iPhone (via iTunes on your Mac/PC) and then restore the iPhone from that backup. This process resets your iPhone to default settings and can erase any firmware glitches.
Finally, if none of the above explains or resolves the issue, then it's going to be a hardware issue. This could be a faulty/damaged display, but may also just be a loose connection. You're best bet is to take it into Apple or some other repairer to look at.