>>1910073That's a track geometry car. They check the geometry and wear of the tracks using a ton of electronic sensors and analogue measuring equipment inside. They get driven over a length of track and determine faults in the geometry and any wear.
When track wear is detected, different fixes are used. Commonly, you'll find rail grinders that go out after these. A rail grinder is a car or entire self-contained train that has equipment that can grind the rails down to return them to a uniform shape. Pic related, it's a rail grinding train with a locomotive, the grinder, additional equipment and a small amount of carriage for work crews to stay in.