Calculate Distance of Light Source with Voltage Changes of Analog Input with LDR

LDR's resistance vs light intensity is probably monotonic, but not linear.

And as for temperature coefficient? Unknown.

Photodiodes are much more predictable.

Ultrasonics a much better bet here

Allan