McCarthy will debut this March with an away match against The Gambia, followed by a home clash with Gabon.
Chelsea are out of the competition too, after losing 2-0 to Newcastle United at Saint James’ Park, while Crystal Palace stunned Aston Villa 2-1 at home.
Erik was appointed in April 2022 and led the club to two domestic trophies.
Crysencio Summerville scored his first goal in a West Ham shirt.
United have lost three matches and drawn one game this season.
“I said from January on we are (playing) finals, and we won many finals,” Ten Hag told reporters. “Now we lost one final.”
Asked if Sunday was one of his worst days on the job, the downcast manager told reporters: “Yes. Of course, it is disappointing.”
Players are expected to wear black armbands, with wreaths to be laid on the Old Trafford pitch and a minute’s silence observed before kick-off.
Jonny Evans, who was making his first United start after eight and half years, provided Fernandez with the assist for the goal from the middle of the pitch.
In his post announcing the news, the former Leicester City defender said he is “extremely disappointed” with the manager’s decision.
