A hard reset will erase everything that has been added to the phone and will put the software back to like new condition. Thus any problematic third party applications, any glitches, corrupted files, bugs, or viruses will be wiped from the phone and the phone will think it’s brand new once again.
Just remember that a factory data reset or hard reset will erase everything from your phone so make sure to backup all your important information first.
If this fails, then it is sure, hardware is the real problem.