What Mark said.
The URDF is published as a topic by robot_state_publisher and you can subscribe to the topic and parse the XML file and then pull out what you need. You can pick up constants that you put in the URDF like wheel_separation but since there aren’t standards for what is in a URDF you need to specialize your code for your robot. What a lot of programs do is read the URDF and then pick up all of the joints. That’s how robot_state_publisher knows how to listen to the joint_states topic to pull out joint positions for all the movable bits.
Then you create tf2 listeners for the frames associated with your interesting links, wait for the transform to first appear, the read your link messages (sensors or odometry), transform them to a common frame, like base_link, after checking the timestamps to see that everything is reasonably current, and Bob’s your uncle. There are samples of parts of this in the documentation and I could probably point you to code in my repositories that does this.