I'm assuming the OP is talking about Carplay? We have had this problem periodically on our 2018, here's what we do.
The cables that Apple provides to connect USB A to Lightning/C will work for this if you can get it to connect. If you have another type of cable, connect it to your laptop and allow on the phone. You should get a popup in File Explorer, if you can browse to the photos on your phone then it works with data.
Go into your settings app on your phone and search for Carplay. Click on Mylink or whatever your car is named in there and remove the profile. Then restart the phone and plug it back into the car while you are on the Carplay setting screen. You should see the car prompt you to connect via USB.
After you connect to it and confirm it works the first time, on subsequent uses what my wife has to do is just unplug and plug the phone in several times and it eventually connects, she has a newer iPhone 12 or 13. For my iPhone SE 3rd gen, I have to restart the phone first before plugging it in, then it works.
GM actually has a Service Bulletin out about this issue but they offer no software fix, just to use the correct cable and to redo the settings as I describe or try to turn Carplay off then back on in the radio settings.
I hopped into 2 newer vehicles that have wireless Apple Carplay last year and in both cases the phone would connect wirelessly just fine without having to do anything weird. I actually couldn't get it to work wired which is weird. If your newer car has the built-in wireless charging then just drop it in the cradle to get juiced up and use wireless Carplay.