If this handgun is going to be used primarily for CCW, the best advice is to buy a handgun you are comfortable with, is properly sized to conceal well, is the type which you will spend hours practicing with, etc. The coolest pistol in the world is useless as a CCW weapon if it is not something you will always carry and become proficient with. Any of the "compact" handguns made by the bigger named companies are designed with CCW in mind. They tend to be a compromise of size, shootability, and power. You really can't go wrong with a Glock, Beretta, SigSauer, or Heckler & Koch compact. I've owned three of those four myself (no H&K yet) and my personal favorite is the mid-sized Glock (19/23/32). The others are just as good for the most part, my Glock 32 .357 just happens to fit me better and consequently I can use it more effectively, and that is key. Strictly personal preference.
As for caliber, again, choose one you will become proficient with. There is no significant difference in antipersonnel effectiveness between a good 9mm, .40 S&W, .357 Sig, .45 ACP, 10mm, etc. You have to consider ammo cost and availability for hour after hour of practice. This is where the 9mm shines. It is found anywhere you shop, it is relatively cheap, and it is easy to master due to its milder recoil, enabling longer practice sessions. If you shop around though, the other calibers can be had for only a little more money.
The questions you want to ask yourself when shopping for a CCW gun:
1) Is this gun small and comfortable enough that I will regularly carry it? The nicest handgun in the world is useless as a CCW gun if it's left at home in the drawer.
2) What caliber can I afford to buy lots and lots of practice ammunition to become proficient? Practice, practice, practice!
3) What gun fits my hand well enough that I won't lose interest in using it, therefore not practicing enough? (See #2 above)
For the AR question, in your price range you really can't beat a post-ban Bushmaster. They are top of the line and can be had for less than $800.
And lastly, welcome to AR15.com. It's incredible how much you'll learn here.