Best component to get speed

While working through some of the physics, wouldnt be possible to just get the velocity from the change in distance and change in time?

This could be achieved with the ultra sonic sensor getting the distance and using time millis to calculate the change in time