iPhone not reacting when connected to electricity
What type of cable are you using? I've seen similar behaviour with


Poor quality third-party Lightning cables
A poor quality USB charger


I think there must be some form of 'leakage' which affects the working of the touch screen when using some sub-standard chargers/cables. I'd suggest either changing your cable or charger and seeing if that helps.