For CQB at home or as a Bug Out weapon as you designed this post to discuss, a handgun would not be the first choice for me. A better option might be a 12ga with a short barrel for the home and longer barrel for Bugging Out or in my thoughts hunting. The boom alone is crowd control, especially in a house. There is more functionality with optional barrels and rounds to cover both your requests.

For a handgun, any weapon, obviously first know what you can buy in your area, know the laws, definitely be schooled and don't skimp on the accessories.

Don't be led by other peoples like or prejudices. Handle a lot of pistols in every shape and caliber. Go to a range and shot as many as you can. Some people love Glock, others hate the feeling and the safety. Some people love/hate 9mm, others think .45 are over rated. Some will feel to top heavy, others perfect in your hand but not so much on your hip.

For a first time hand gun, a Ruger GP100 has been mentioned. Owned one, loved it. Great revolver in .357 caliber.

A lot of what you will should consider in home defense is directly related not so much to the caliber you use but the clarity of your voice and action. If you can, first call 911. Then let the vandal know the house is occupied, your armed and police are in route. Remember what they are wearing and look like for description to the police.
_________________________
Don't just survive. Thrive.