Have you tried a different cable? I never had this issue with my iphone, but I just got a google pixel 2 xl and it would just go on a connect/disconnect loop and was pretty much unusable with android auto...ended up getting an Anker brand cable on amazon as per some of the forums I read and everything is working fine now...I'm sure if you have an apple OEM cable though that will work fine, mine always did...this was just the first phone I've ever had that didn't come with a usb-a cable (came with a usb-c to usb-c cable so I have nothing I can hook it up to)...had to get some usb-c to usb-a cables
hope that helps