sensor data hangs when going through if/then statements

when reading it through the serial monitor, it freezes for a few seconds when the if statement arguments are met.

says that you have one problem.

the serial monitor is showing the numbers fluctuate even when the distance is controlled, and remains the same. something with the sensor data is not giving consistent number readings, rather fluctuating readings despite your logic.

This says you have a different problem.

When you make up your mind what your problem is let us know. (I think you are the one with the logic problem.)