IPhone 5 lines down screen then restarts, what's happening?

I will be in the middle of something on my phone, and red lines will appear on the screen whilst it freezes. The phone then restarts, does anyone know what I should do? Also I didn't buy it from an Apple Store so would they still fix it for me?

I think if you take it to the Apple Store, they will fix it for you. Or at least tell you what's wrong with it.