Hubble's constant is a measure of how the expansion velocity (in units of kilometers per second) of the universe changes with an object's distance from us (in units of megaparsecs), yielding units of km/s/Mpc. It is improper to simply cancel the distance units which would leave you with units of frequency (i.e., inverse seconds).
Another example in astronomy is the unit given to monochromatic flux, which typically has units of Joules/meter^2/second/Hertz. Note that the unit has both seconds and Hertz. Now, one may naively simply cancel Hertz and seconds, leaving the unit as Joules/meter^2, but this is wrong. Monochromatic flux measures the energy (in Joules) passing through an area (in square meters) in a given time interval (in seconds) of light of a specific frequency (in Hertz). Seconds and Hertz are measuring different quantities and cannot be cancelled when dealing with monochromatic flux.