you have mutually exclusive purposes lumped into one pile. first, decide the job THIS gun is going to do for you, not all the jobs guns COULD do for you.
You need practice, and to grow a set of safe gunhandling habits. You need practice, and to grow a set of gunhandling skills.
These aren't exactly overlapping purposes. Fast is something gun ranges don't much allow. It gets people hurt, hurrying. Which gun is the fastest quickdraw gun? First is highly desireable, in gun fights.
Accuracy has more to do with recoil than anybody admits. The second shot, you're already reacting to adrenalin, stepping on your own muscle memory and training, and it NEEDS to hit something variable (same target again, different target).. and you're just a busy little rascal there for about a half second.
Don't be dragging the barrel back down out of the air to line it up.
Get the longest barreled, lightest recoiling, affordable to practice with (a lot), gun that has adequate power for self defense.
.22LR is a great plinker, but if you're not stopping there, don't start there.
9mm is adequate. .40 is less adequate because it takes a bit more practice to handle the snappy recoil, and they cost a bit more.
.38 special is adequate. .357 is less adequate for the same reasons. Calling it a .357 if you're shooting .38 specials in it, ain't truthful.
Happens you can get a 9mm glock with a .40 barrel I *think* or maybe it's the other way around. Worth considering.
Could be a decent .357 would make a bang up .38 carry piece.
In either case, a longer barrel matters more than anybody admits.
Don't go under a 3" barrel. IF at all possible, and stay close. Don't shoot the most powerful rounds you can, shoot the LEAST powerful round with adequate terminal ballistics.
A glock 9mm with a .40 barrel sometime, or a glock .40 with a 9mm barrel NOW, or a smith & wesson .357 handgun shooting .38s or a .38 shooting .38s. If you use a ruger instead, pay money for a tune up on the action. You'll break even, far as saving money. Just buy a smith, & you're there.
With one exception I can think of, the Ruger Speed Six, pre GP-100, 2 3/4 inch barrel.. is a GEM. It's the only gun Bill got dead solid perfect. And me a smith lover, has to mention it, shameful.
How you carry and how big you are and the attitude of the people WHERE you'll be carrying all deserve consideration before you spend money. The gun that shoots best is bigger than the gun that hides best. I will never advise stealth over effectiveness in action. Be prepared to hide a LARGE carry piece, as best as you can.
Don't have a .22, don't have a 2" barrel, don't have something too big to hide or too little to shoot convincingly..
and the two cartridges under consideration NOW are 9mm and .38 special. LATER you'll do it different. 6 shots are more than 5 shots. It'll be on the test, remember it.