I'm curious to know if planes have distance counters similar to the ones in cars indicating how many kilometres/miles the plane has flown since being put in service.
A Hobbs meter measures the time spent in a general aviation aircraft with the power on.
Planes differ in that time is easier to record than distance. For a given airspeed, the distance covered by the aircraft depends on the wind, altitude, and other factors.
Modern airliners would record the period each engine has run, flight time, cycles (one cycle is one pressurization/depressurization cycle), etc., digitally.
Those records are then used to track the time between overhauls (TBO). Same as with cars.
For small planes, a tach timer is used to record the revolutions the engine has made, this one is used for TBO.
(Source) Image of tach timer.
No, there's no odometer to measure distance on an airplane because it is not a good measure for maintenance. Airplane engines have a service life which is determined by the number of rotations it has made or the number of hours it has been operating. An airplane's body (wings, fuselage, etc) will require more or less frequent maintenance based on the stresses placed on it and how it is flown.
Take for example 2 scenarios, both with identical models of Cessna 172. In the first case the airplane is part of a training organization and mostly flown by student pilots. It will be subjected to plenty of hard landings, and the engine will have lots of time at full RPM. The second airplane is flown by a retired air force pilot who does lots of cross country. Over the same distance the first airplane will need significantly more maintenance than the second.
Distance is also hard to measure because the air moves. In a car the odometer is changed by tire rotation, which is directly measureable against the ground, but the air is a mass which is constantly going from place to place. Again take two scenarios, both in which an airplane must fly 300 nautical miles at an airspeed of 100kt. In the first case there is a 30kt headwind, in the second a 30kt tailwind. In the case of the headwind the ground speed is 70kt and the trip takes about 4 hrs 20 mins. In the second case the ground speed is 130kt and the trip takes about 2 hours and 20 minutes. The distance over the ground is exactly the same but one trip takes almost double the time of the other because the distance through the moving air mass is much longer.
We use engine time. The tach keeps track of engine time and that is what is recorded in required logs and what dictates maintenance cycles, part 135 overhauls etc. Hobbs is only used for pilot log books and serves no regulatory purpose.