Welcome to Android Central! You did a full factory reset and it still happened? When you set the phone up again, did it automatically install all of your previous apps? Try booting into Safe Mode, which temporarily disables all 3rd party apps. If the problem resolves, then you know something you installed is interfering--you may have to uninstall apps one by one until the problem goes away. If the problem persists, then you may have a hardware defect.
Safe Mode instructions at the bottom of this article:
Reset: Samsung Galaxy S 5 | T-Mobile Support