That's an odd problem...
I would start by doing a hard reset (home & power button for 10 secs) and then a full [https://www.theiphonewiki.com/wiki/DFU_Mode#iPad.2C_iPhone_6s_and_below.2C_iPhone_SE_and_iPod_touch|DFU Restore] if that doesn't help. Make sure to backup your device first (if it is already trusted on iTunes, it will be easy).
Once those "software" solutions have been tried, if you still have the problem, it is a hardware issue and possibly a logic board issue. At that point, you will want to have it looked at by an experienced tech.