CarPlay stopped working - could it be the cable or the phone?

CarPlay used to work when I plugged my iPhone into the car, but now it won’t connect. The phone still charges through the cable, so I’m not sure whether the cable could be faulty or the problem is with the phone or car. How can I narrow it down?