Inventory Trash is a small QoL-improvement mod that adds a trash button directly to the survival inventory.
The button sits next to the recipe-book and lets you delete items from the stack currently held by your mouse cursor.

The deletion is handled server-side, so on multiplayer servers the mod must be installed on both the client and the server.
If the server does not have the mod installed, the trash button stays hidden.