Pipe OD measuring with KY-008 Laser transmitter & reciver module

LDR is slow reacting, try micros-timing from the start of a laser pulse to the detection of the LDR.

A phototransistor detects light near-instantly compared to LDR.

A steel pipe (to make an EM readable scale so can be narrow) with a button magnet at each end will have a magnetic field that varies along the length and can be read with a Linear Hall sensor. A calibrated strength:position table in flash can give an absolute position. Use that and you won't have to guess position by time measures.