Artificial lighting isn't a problem. It's daylight.
As the daylight varies, due to clouds, shadows, time of day etc., the output from the photo-diode or photo-transistor will move accordingly. This makes detecting a change due to a detected object tricky, as there is no 'constant' level to compare against.
You can compensate for this by turning the LED off, read value using ADC, turn LED on, read value again. The
difference between these two values will be low if nothing is reflecting, and high if there is reflection.
An even better method is to use a pulsed transmitter and a tuned receiver. The principle is now to detect a frequency, not a level. This is how the commercialy available proximity detectors work.
Writing a tuned receiver in PICAXE BASIC might be possible, but it would be a challenge. Much quicker to get one ready-made !.
There are plenty circuits using the LM567 tone detector, a workhorse of many an Elektor circuit back in the day . Here is an example :
The transmitter LED is driven at about 10KHz, and the IR receiver signal is capacitively coupled to the tone detector on pin 3. The tone detector only needs about 25mV signal amplitude at the correct frequency to 'lock on'. There is unlikely to be any other 10KHz source around, so the detector is tolerant against most kinds of interference.
( In that circuit above, I would replace the 2N3904 with a MOSFET, and put a gate resistor in. )
Cheers,
Buzby