DISCLAIMER: Owning a firearm is illegal in some places. If a permit can be obtained in your location, please obtain the permit before acquisition of any firearm, and please acquire them through the proper channels (FFL dealer). You are solely responsible for any damage you cause to properties or people, and it is not my responsibility nor will I be held liable for your actions.
If you truly know how to use them both, then both, otherwise, I have to say Shotgun. Most people think that they are proficient in using a handgun for defense because they go to the shooting range and shoot at a paper target a few times a week. Some even go a step further and shoot at a range with moving targets. Unfortunately, humans don’t always move sideways in a straight line at a constant speed, so even practicing at ranges with moving targets isn’t good enough for defense.
When using a handgun, you need enough distance from you and the opponent, otherwise, you may be disarmed and they will kill you with your own weapon. If they are too far, you have to be an excellent shot in order to hit the target in the optimal location. With a shotgun, you can hit something close, or between 30 to 100 yards at distance depending on the ammo and your ability to shoot. At closer range, you can use it as a blunt force weapon, and if the enemy is 10 feet away, you can certainly do some damage by aiming in the right direction and pulling the trigger.
Now, let’s talk about another use, hunting. Hunting with a handgun is very difficult. Hunting with a shotgun is fairly good though I prefer a rifle for big game. The shotgun can provide defense and hunting for food. This is why I prefer the shotgun over a handgun if I had to choose. Do you want to be proficient at both? I highly recommend taking an outdoor handgun training course that forces you to run and get your heart rate up quite high before shooting. A good handgun training course should also provide force on force training in close quarters as well as moving targets in an outdoor environment. Shot placement and target discrimination should also be taught as this is crucial if you want to keep your family alive during a hostile situation.
Imagine your daughter has been grabbed by the assailant and he has her by the neck with a gun to her head. Shot placement is critical because you may hit your daughter and/or he may still pull the trigger and kill your daughter. Doing all of this while your heart rate is thumping past 160bpm is definitely going to be difficult. This is a scenario where a handgun is the best, but you really need to be trained and have practiced for this.
My recommendation is start with a shotgun, and work on your pistol and rifle skills. It’s best to be able to use all three in a survival situation, but hands down, shotgun is a great defense and survival tool.