Cable and Bluetooth issues are usually the cause of the problem if Apple CarPlay keeps disconnecting, but there are other solutions you can try.
How to FIX CarPlay When It Randomly Disconnects! (2022)
There are many issues that can lead to repeated Apple CarPlay connection interruptions. The most common causes of this problem are:
If you’re having an issue with CarPlay connecting and then disconnecting while driving, try each of the following solutions. If one of the solutions seems to work, you can pull over, give it some time to see if the problem goes away, and then go back down the list and try the remaining solutions if the problem returns.
Turn on both Wi-Fi and Bluetooth. If Wi-Fi and Bluetooth aren't turned on on your iPhone, you may experience connection issues. To turn on Wi-Fi and Bluetooth, open the Control Center and tap the Wi-Fi and Bluetooth icons if they aren't already turned on.