As far as I know, you have to program it. For example, the app „pon“ (shopping list) you can set it, when using the app, that the lock screen is deactivated.
I'm not a programmer, but I know that there are some apps that do have this feature.
We are working on this feature, and I do have this option already on my own iPhone. But it's not reliable. Because your GPS in the car is very hungry in memory and CPU, Apple decides to stop all background activities and you can do nothing.
so we are not releasing it because people will keep saying it doesn't work, and we will have to say they must start the app every 10 minutes.
The solution we are working on is Silent Notifications. It's also what makes Widgets and Live activities reliable instead of freezing on old data when Apple decide to free resources for something else