Maybe its the phone and then?
Ie a loose phone socket.?
Have you tried it with a different phone or tablet?
Failing all that it could be a damaged loose socket in the dash.... but thats normally only when people have been ramming pens or othing things into the socket.... or been too rough with trying to plug in a usb cable the wring way.....