Over longer range, you need to send pulses and detect the change in the receiver, otherwise ambient light will trigger it. Ambient light usually doesn't interfere with a short range thing because the signal strength at 1 cm is so much higher.
IR with a packet of pulses is used for laser tag & military game guns, those range at least 100s of feet.