My iPhone 7 randomly restarted and now the home button doesn't work?

I was just using my iPhone 7 and all of a sudden the screen went black and turned off and then turn back on by itself and then the home button doesn't work anymore except for the thumb print sensor. Why did this happen and can I get it replaced?

Take it to the genius center in an Apple store near you. They will most likely give a diagnosis to the problem.

Yes