Well, both are harmful!
But Gamma Radiation is an ionizing type of radiation. In the human body that means it causes mutations in DNA and damages cellular mechanisms.
But UV rays are (relatively) safer. Though they can cause skin cancer, that is it. They are also far more useful such as triggering Vitamin D etc.