TinyInv is a Minecraft mod, that allows you to manipulate the available inventory and hotbar slots on a per-player basis. This includes:
This can be done both globally for all players - inside the config file, or individually for one player using attribute modifiers. The mod also has a built-in way of adding attribute modifiers to existing items and status effects using datapacks.