Basically, “less” works with singular nouns and “fewer” works with plural nouns. For example, you might drink less milk than your friend, but you ate fewer cookies.

You drink less water, but fewer glasses of water. This is because “water” is singular, whereas “glasses” is plural.
You eat less soup, but fewer bowls of soup.
You purchase less perfume, but fewer bottles of perfume.
You packed less clothing, but fewer clothes.
If you understand when to use “much” as opposed to when to use “many,” then another way to think about it is this: If you would use “many,” use “fewer.” Think: I didn’t eat as many cookies as he did = I ate fewer cookies than he did.
If you would use “much,” use “less.” Think: I didn’t drink as much milk as he did = I drank less milk than he did.