Plugging your iPhone into your car with a cable is the best option for battery life, especially on lengthy trips where having enough juice is a big concern. A wired connection keeps your phone charging the whole time CarPlay runs. If you're worried about long-term battery health, CarPlay will respect the charging limit you've set under Settings > Battery > Charging on your phone.
When a wireless setup is your only option, a few tricks can help save some battery life. Make sure you turn off your iPhone's screen, since it can unnecessarily stay on while powering CarPlay. Enable Low Power Mode on your phone to avoid unnecessary background processes while driving.
Cars that support wireless CarPlay may also include a wireless charging pad. This can help, even though wireless charging isn't as efficient as wired. Another workaround is to download your favorite playlists or new podcast episodes to reduce your mobile data usage and reliance on changing cell towers. It's also a good idea to avoid using navigation apps when you know the route, since that prevents GPS from being on all the time.
Keeping your iPhone up to date with the latest software is important, too. Since CarPlay runs though iOS, any battery usage improvements Apple makes to CarPlay come with new versions of the operating system. That's one more reason to keep iOS updated, even if you're not getting new features.