Both can do the job. Look for labels that say "Meets ANSI UV Requirements" or "UV absorption up to 400 nm." That means the glasses will block 99% of UV rays, compared with about 70% for most cosmetic glasses.
Sunglasses are key, because up to 1 in 10 skin cancers strike the eyelid area. Sun can also raise the risk of cataracts, macular degeneration, sunburn of the cornea (keratitis), and cancers of the eye.