Either of those rounds are fine if you intend to do small game hunting or close-medium distance varmint hunting (prairie dogs.)
FWIW, the .17 HMR is based off of the .22 WMR case, so if you do some research, you may be able to locate a gun that can shoot both simply by swapping out barrels. I know some guys who've done this with 10/22's chambered in .22 LR. They'll get a second barrel for .17 HM2 that they can swap out.
Neither of those rounds, however, would be anywhere near an ideal choice for a defensive or carry round. I would strongly advise against relying on any rimfire round for personal defense as they tend to be underpowered. Rimfire cartridges are also notoriously unreliable with all but the premium ammunition brands.