if I am reading your code corectly the second line switches off the motor once it reaches the point, right?
I if thats the case, I would rather do
if >=(Set Distance)
since the potentiometer can skip values. My complete code would be something like this:
Unsigned int pot == Potentiometer //get the potentiometer value
if(pot < wantedvalue) { //check if we need to move up more
motor(lift, 256) //Yup, we need to move up more, so let's do it
} else {
motor(lift, 127) //there we go, we reached our desired value. Let's stop the motors
}