It depends on what you’re concerned about.
Hydro (often) uses a lot of cement, and while it can be long-lived it’s sorta a one-shot deal. Once the reservoir silts-up I understand that it is effectively gone forever. It’s not economically feasible to dredge the silt out.
Also, dams destroy river ecosystems permanently. Solar panels covering some land certainly uses the land, but they don’t necessarily choke off entire ecosystems in the way that dams do.
It also depends on what the alternative is.