Are you using an actual Apple Lightning cable? Third party cables, most notably Chinese-made cables, are notorious for not functioning properly with Apple devices, and not supplying enough power. And they're everywhere, from every source, like Amazon, in best buy, or whatever. You have to look for Apple MFI Certification on lightning cables if you want it to work correctly, which is a pain, but it's because a lot of third party manufacturers are cutting corners to make the cable cheaper.
I recommend going to Monoprice
if you need any kind of Lighting cable, they have a huge selection, they're inexpensive, and they're all Apple MFI certified.
This is the cable I use, it costs 5 bucks from Monoprice, is certified, and is the exact right length and angle for the little cubby where the USB port is. Monoprice 90 degree 6" Lightning cable
The pic below is that cable in my Niro.
And if the cable isn't the issue on yours, sorry for wasting your time, haha. But I figured I'd mention it just in case, because the third party chinese cable thing is a real issue that will genuinely prevent CarPlay from working correctly.