There was a time, decades ago, when a UV filter was needed because existing lenses didn't then have much in the way of UV stopping power. Nowadays the lens itself will usually be as good or better at it than even the most expensive UV filter. And in the example of my recently bought 77 mil filter thread lens, I could either buy a filter, or another lens on
ebay. ( A joke, but only just!) Or I could get something else that would be more fun than the filter.
The question is, what does a filter do that the lens cap won't. Transmit light, of course, as well as protect the camera - lens ONLY. If the lens is in an environment where it is in danger, you should be protecting the camera itself almost as well. So, I would use a filter when at the beach, in a sandy or dusty environment, stuff like that. Then, maybe you should be using a different filter anyway? And don't get caught out using Cokin or similar - dust and sand gets round the back of the holder!
I use a UV filter on my 1.7 50mm, cos I need the light, and don't use a lens cap. I will risk the 24-70 mil zoom without a 77mm filter, cos I am a cheapskate. But for my Dimage Z1, I have bought the 49-52 mm extension tube and a UV filter because together they seal off the only area of the camera open to the environment, they protect the wobbly lens mechanism, and because it reduces the "start up time" that is so irksome with digital cameras - I don't need to use a lens cap..
I can get my Minolta x300 out, focussed and 3 frames into a sequence before the Z1 has got itself ready for the first shot.
And if you get into systems like Cokin, always buy less filters than you think you will need - drawers around the world are like a "plastic sink" full of starburst and rainbow filters, used only once. Or be like me - my local "real" photo shop sells the wackier ones in useable condition for about a dollar each.