Few different ways:
Create a restriction policy with the following managed;
Configuratin Profiles, (Policy), Restrictions, Apps: Removing apps Managed/Restrict
Devices, Mobile Device Apps, App: Deselect Allow users to remove app (iOS 14 or later) - uncheck
I have not worked recently with a device low on space, so I'm not sure how the automatic offloading works in that situation.