Infrared distance sensor picks up distances that are not there
I see one problem with your code and how it relates to this device.

The output from the sensor is not the monotomic function you describe; not over its entire range.  Your conversion function describes only a section of the response.  The device is only intended to be used when an object is in range 10-80 cm.

You should check that the voltage at the analog input is valid before performing the math:

int v;

v = analogRead(sensorPin);
// sensor is valid in range 0.4 to 2.5 V
if((82 &lt; v) &amp;&amp; (v &lt; 512)) {
  // voltage is in usable range, can convert
  distance = 12343.85 * pow(v,-1.15);
  if(distance &lt; 50) { 
    digitalWrite(ledPin, HIGH);
    delay(1000);
    digitalWrite(ledPin, LOW);
  }
}
else {
  // no valid reading - probably just skip and try again on next loop
}


With that the false triggers may be eliminated.