Answering just because I love grammar!
It's a very general rule that
less is for uncountable and mass nouns (including money, water, and sugar) but
fewer is for countable nouns and units of quantity (such as dollars, gallons, and ounces).
So a stickler may say that you should say "I have less money than you" but "I have fewer dollars than you," but there are many examples of usage of
less with countable nouns that go back many centuries, and it's also common to use with units of distance, time, etc.
I stick to that rule as a general guideline, but I realize that English dictionaries are descriptive rather than prescriptive and that language evolves a lot.
A few relevant sources:
We all want fewer problems and less trouble with 'fewer' and 'less'
www.merriam-webster.com
Less or fewer ? - English Grammar Today - a reference to written and spoken English grammar and usage - Cambridge Dictionary
dictionary.cambridge.org
Use the adjective fewer to describe countable items; otherwise, use the adjective less. And here’s a tip: in general, if the noun is plural, use fewer; if it’s singular, use less: Fewer treadmills line the floor of the gym. Less equipment lines the floor of the gym. In the first example above...
style.mla.org