It's usually approached as a budget reduction exercise: Company is reducing budgets by X%. Select which projects get cancelled. Now work with managers to identify enough employees to lay off to reduce headcount spend by X%. Now reorganize remaining employees across remaining projects, with the understanding that a few extra people will leave due to future layoff fears.
The idea that companies like Twitter/X just removed a lot of employees and then operated exactly the same as before is a myth being propagated online right now, but companies must change their operations as part of layoffs. It's usually not obvious from the outside because the core product always gets attention, but side initiatives, internal tooling, new feature concepts, and even less-visible things (think bot/spam detection on X) lose attention that they may have needed.
But no, the idea that companies are making 10% of their workforce disappear at no cost to the business is just fantasy. The only time I saw this happen was when a company hired so fast that they didn't have work for some people to do, but that mistake was quickly recognized.