Sneak + Interact with the QoL Settings item and choose Item Lock, then Choose Item to Lock / Unlock. Select any inventory stack.
A locked item is never deleted by the Trash Can and never moved by Quick Stack. Locked items show a tag in their tooltip.