Astronomers measure motions of celestial objects in two directions using different techniques:
Combination of these components gives the 3-dimensional velocity of the object.
The latter measurement of radial motion is practically independent of how far away the object is, and can be done nowadays with an amazing accuracy of a few m/s, using the line spectra from celestial objects, and very precise spectrographs. These measurements give an invaluable contribution to our knowledge, not only of motions of those celestial objects themselves, but also about various other physical characteristics of those objects and their interactions.
Astronomers study motions inside our galaxy the Milky Way, leading to knowledge about its rotation as a whole, study the velocity and rotation of other galaxies, and ultimately measure the expansion of the Universe which is an extremely valuable tool in modern Cosmology.