Meta is laying off thousands of employees as part of a major restructuring aimed at cutting costs and accelerating its push into AI.