Box1 (ping sensor, Arduino, xbee, and resistor led). Box2 (ping sensor, Arduino, xbee, and resistor led). The xbee's are set up as line passing, only.
There is no mention of the switch that seemed to be the focus up to now. This is the first time that XBees have been mentioned.
There is no code to read, on one Arduino, what the XBee on the other Arduino sent.
Sending the distance ONLY makes sense. The only possible values for distance that you are concerned about are between 0 and 255, so, use Serial.write() to send the value, instead of Serial.print(), assuming that the XBees are on the serial port.
The print() method converts the value to a string, making reading more complicated. The write() method sends the value in binary. Read one byte to get the value sent, as a byte or int, rather than a string.