Hello iwuese,
Thank you for that information. To definitively determine whether this issue is hardware or software related, we can create a current backup of your data in either iTunes or iCloud, then use iTunes to restore your iPhone to factory settings. After restoring, set up the iPhone as new, and test it out with no additional data loaded onto it. If the issue still occurs while there is no additional data on the iPhone, this will rule out the issue being related to software, only leaving hardware as the source. Here is a link for the steps to reset to factory settings: Restore your iPhone, iPad, or iPod to factory settings
Let us know if the issue occurs while there is no additional data on the iPhone after restoring to factory settings and setting up as new, and we can find a solution from there.