U.S. companies have continued to trim headcount in recent months, with a fresh wave of layoffs across the technology, media and finance sectors as firms rein in costs, while investing heavily in AI infrastructure.