Turns out the Text Counter Plugin can be used to solve this problem; this plugin was made to animate text counting up/down, but using drivers it can also display distance to another object (or any property which can be used in drivers really).
After installing the plugin, add text, go to the text tap and find and activate text counter
If desired change »padding« »decimal«, and use suffix and prefix to write what will be before and after the distance displayment.
Then add a driver to counter value
finally go into the graph editor and change type from graph editor to drivers, select the current driver; find »drivers« tap in the disebar to the right, if driver type is not scripted expresion, make it scripted expresion; under variables add new variable (if one does not already exist) change type to distance and as object 1 and 2 select camera and the text.
then change expresion to
where var is the name of the distance variable, and the scale is the scale between blender units and the desired units; in this scene i have 100 meters for each blender unit, and i want distance to be displayed as kilometers, therefor my scale is 0.1:
The text now automaticly calculates the distance as the camera and the text moves around the scene.
Unfortunately the suffix and prefix of the text can not be multilined (not even by typing in \n) and only one changing number per text object is supported