I don't think we know the entirety of what happens in the skin with UV exposure. We are pretty sure that vitamin D is good, and that cancer is bad, and that seems to be all that people talk about, but there are a lot more things happening that we don't fully understand.
I suspect when we know more, the best answer is going to be moderation. But it's really anybody's guess right now.
There are even things that we do know about but generally aren't talked about such as UV-triggered nitric oxide release[1] which moderates blood pressure among other positive effects.
I want to be clear that there being pros and cons whose relative proportions change is very different than what some other commenters seem to be implying which is closer to a threshold model of UV safety which clearly doesn't exist and is non-scientific.
1. https://www.nature.com/articles/s41598-022-13399-4