Companies are pointing to factors like tariff costs, shifts in consumer spending, and investments in AI that have led them to let go of thousands.