Using a motor as a sensor

If its a brushed motor you can measure the EMF which is proportional to speed (but rather noisy). connect one terminal to a potential divider consisting two 10k resistors to 0V and +5V, and the other to an input pin. You may want protection against overvoltage on that pin (I use a high resistance potential divider to limit current).

Then so long as the voltage is in the +/- 2.5V range it will be measurable on the analog input. I'd also put a few uF across the motor terminals to reduce noise. Higher voltages will need another potential divider across the motor terminals.

Other types of motor like brushless and stepper tend to give AC waveforms that will be a bit harder to deal with.

If you need any true accuracy a shaft-encoder would be better.