That happens all the time, or did when I worked for FedEx. The two companies generally have by boxes near one another, particularly in big city office buildings, so our guys, upon noticing such an error, would just chuck a UPS package in the first appropriate by box they saw.
I imagine they take it back to the customer or to a FedEx Office (formerly Kinko’s). Taking it to the Ground facility wasn’t practical; it was too far from the Express hub).