Why does my iphone 5 do this? - 2

When my iPhone 5 is locked, and on a black screen it seems to freeze. It sometimes takes a while of pressing the home button or the lock button for it to show me the lock screen. Does anyone know why this might happen?

Seems more like the button is going out on your phone not it freezing

Probably because it is old

Regardless, i can't stress it enought. If you haven't dropped it in water or cracked the screen, take it to the Apple Store and they should give you a free brand new i5 replacemnt if you are under the 1-yr warranty. I had a problem with my i5 home button not responding but since I scratched the phone and wanted a new one, I got one of those hard drive magnets put it on the back for about a minute and that fried the internals and it wouldnt even turn on. 20min later I arrive at apple store and tell the genius it just won't turn on. 5 min later he comes out of the back room and said that when he hooked it up to the machine, it still wouldnt turn on so he comes out with a small white box with a BRAND NEW not refurb i5 and I pay $0, thank him and leave satisfied. Your only problem is trying to find a strong magnet to mess it up so you get a new one.