Limiting linear distance from power screw and electric motor

So I have in mind the simple control of a dc motor (possibly a stepper instead) to spin one way or another at a constant speed by control of a simple button for each rotation direction. The purpose of the motor is to move a power screw (lead screw); think of an electric screwdriver that turns a threaded screw, that then linearly moves a connected object. So if I want to move an object perhaps an inch, I press the button until it is what looks like an inch.

Question: I need to be able to control how far the linear movement goes and stop at the limit (an equivalent problem of how many rotations of the screw I guess); so if movement reaches 5 inches, stop. I am assuming this involves what is know as closed-loop control. How do design it so that it doesn't go beyond a certain point? Is there a programming, sensor, or combination solution to this?

You could use limit switches.
You could use a stepper then step it the number of times to get you to the distance desired.
You could use a encoder attached to the shaft end to count number of revolutions.
You could use a linear optical encoder to measure where you are.

Unless there is slippage, counting the number of steps is a good way to do this.

With a stepper motor you will need at least one limit switch so you can detect the zero or home position.

Stepper motor basics may be useful

A suitable DC motor and two limit switches (for the two extremes of movement) might be the simplest option. If you wire it up correctly you would need any Arduino.

...R