For Concealed Carry: I prefer 2", 2-1/2" and 3" barrels on Revolvers. My prefered carry method is in a Pancake holster. I find that barrels longer than 3" are harder to conceal. They also block access to your back pocket.
That said I do conceal carry 4" guns some. I normally move my Billfold to a different pocket. Grips also come in to play here. Rubber Grips tend to grab your shirt more, where wood tends to let you shirt glide over the grip.
Grips are also what makes the handgun Shootable. Really dinky grips on say a J Frame will make it very hard to shoot for example. You need a good grip on the gun to shoot it well.
A K Frame Round Butt Smith & Wesson Revolver with a 2", 2-1/2" or 3" barrel will make a very Shootable Platform. The K Frame is and always has been a very Shootable Platform.
In a semi auto I only carry one, that is a full length 5" 1911 Colt. I carry it in an Askins Avenger style holster. A 4" Commander length is probably a better choice in a 1911 however.
In a semi auto I would look at a compact version of something that works for a Duty Handgun. That would be more than likely an Smith & Wesson M&P, or a Glock. At the moment the new Smith & Wesson M&P Shield would probably be my first choice for concealed carry in a semi auto.
Home or Car gun: Pretty much wide open here. My wifes house gun is a 4" S&W 686, my neighbor gals house gun is a 4" Model 10 S&W. My daughter in laws house gun is a 4" S&W 64. If a woman may be the person needing to operate the house gun my recomendation is to stay with a K or L Frame Revolver with a 3" or 4" barrel. You have no issues jaming a Revolver by Limp Wristing it. This is a big problem with lady who are not shooters. The newer polymer semi auto's have no frame weight. If a person does not get a solid grip, and hold the grip solidly when firing, the gun will short cycle and jam. Someone who is not a Salty Shooter does not need a stopage in the middle of an encounter, especially in the dark.
A revolver will normally fire every shot till it is empty with anyone operating it. In my experiance most women prefer a 4" barrel length for a house gun.
If a person already has a handgun with a longer barrel, this is not a big issue for a house gun.
Range gun: This can be anything again. My most heavily shot handguns would be my 2" LCR-22, 4" 617 S&W, and 4" Ruger MK III in 22's. In center fire my 4" 64 S&W, and 4" 686 S&W will be most most heavily shot handguns.
The 22 LR is economical to shoot. The 38 Special is also reasonably economical, and easy to find ammunition for in most locations.
You were asking about Barrel Lengths. In a range gun I prefer a 4". I belt carry almost all my handguns, and a barrel longer than 4" I find to be too long to be handy for me.
Hunting Handgun: I have a few. My short barrel revolver is a 7.5" Super RedHawk Ruger. I also have the 9.5" version. I want a long barrel for hunting. As I use an UltraDot sight the barrel length is mostly an issue of velocity, and being handy off a rest. A long barrel is much handier off of sand bags, or a monopod. I carry my hunting handguns in a case with shoulder strap like a muzzleloader possibles bag. with the case open on the end it is about like a horizontal carry shoulder holster.
If you are looking at a single handgun for Home Defense, and Range Shooting. A 4" K or L Frame S&W or GP100 Ruger would be my recomendation, followed by the 3" version if concealed carry were added to the mix.
In a semi auto a compact M&P or Glock would be my first choices. I would get a grip on one and check it out before buying however. A buddy of mine has a small 45acp Glock that I am not impressed with. With that said he is a shooter, and shoots it well. I am sure I can shoot it just fine, I just do not like the grip feel at all.
My 2 Cents