It's important to understand that the Apple AirTag does NOT know its location. It has no means to do so. Instead, it relies on the Apple Find My Network, which consists of literally millions of iPhone to relay the tag's ID (via Bluetooth), along with the phone's GPS location to the Apple servers. That is where you would see the tag's "location" with the Find My app.
So, in the case that you are presenting in your post, your iPhone being within Bluetooth range of the tag, will see the tag in the Find My app. However, that location may not always be where it's actually located, but based on the last time an iPhone sent its GPS location to Apple.
So, if getting accurate location updates while driving is your goal, you should consider getting a GPS-based device, like a Garmin or similar for that purpose.