Yes, it's legal for you to be fired by both.
The 'non-compete' clause applies ONLY to situations where an employee has left one employer to work for another in the same business. And what it restricts is the employee's ability to take proprietary information and trade secrets learned on the job to a new, competing employer – not the employee's right to go work for the competition.
In your case, when you are employed, you legally owe your employer loyalty. You are not doing this if you are working for a competing business at the same time. As you were being highly disloyal to both companies, you were terminated by both companies. 100% legal for them to do that. Either one could have demanded that you quit the other in order to stay employed but neither made that choice, and neither was required to.
Your disloyalty is not illegal in terms of being a criminal act. But if either FedEx or UPS, or both, could prove that you damaged them monetarily through your actions, they could sue you in civil court.
I would assume there's a 'non-compete' clause in either one or both of your employment contracts.
No company wants your working for their direct competition.
If the non-complete clause is there, it's legal.
As a matter of fact, in most cases it's legal to fire anyone with no reason as long as severance is paid properly if it's due to an employee.
How long have you been with UPS, but more importantly how long have you been a Teamster? If you are paying/current with your Union dues, it's almost impossible to get fired from any Teamster Union job. As long as you don't steal and don't threating to cause harm to another person or yourself, management can't stop you from getting your job back, even after being fired. Always talk to your Teamster representative. All the corporations have lobbyists working hard for their interests. A STRONG Union is the working man's last trump card agaist these corporate vampires. Firefighters, Police, Teachers, and Fed Workers all have Unions. Call your local Teamster office asap. They live to fight for their workers' rights.
Why would it NOT be legal to fire you? You can legally be fired even with no reason as long as it's not because of something legally protected, like your race, gender, religion.
Hmm! What major conflicts can you create?