The rifle will shoot better by far, but the handgun obviously weighs less. If you plan to shoot a lot, buy the rifle. if you plan to carry it around a lot, such as bugging out, then the pistol will save you weight & bulk at a time when you're already hauling a lot of other survival stuff. Maybe buy the rifle now and the handgun later? It would be nice to have both since they can share the same ammo & magazines.
Maybe you can get a handgun and a rifle conversion kit. The Beretta U22 Neos has a kit, but they're kinda rare.
IMPORTANT NOTE: It is legal to convert a handgun into a rifle, and back into a handgun (ATF 2011-4) but DO NOT convert a rifle into a handgun! That's a major federal crime equal to building an illegal silencer or machinegun!
On the other hand, I really enjoy shooting pistols more than rifles.