I recommend not interacting with
itemList directly. Instead, use a for loop from 0 to
contents.capacity and go a
GetSlot(index) call at each iteration. That is the way the game code usually does it. Removing an item from a list while iterating through it will also not work with foreach, but you can do it with a for loop as long as you account for the size changing mid loop.
If I recall correctly, to remove items instantly from a container, you have to call
RemoveFromContainer() in addition to
Remove(). Assuming there's only one item, you could probably do something as simple as the following.
var waterItem = waterJug.contents.GetSlot(0);
if (waterItem != null)
{
waterItem.RemoveFromContainer();
waterItem.Remove();
}