A Glock can do anything an AR-15 can.
A Glock cannot kill someone past about a 100 yards; an AR-15 can easily kill at 800 yards. Glocks lack the accuracy of an AR-15 even below 100 yards. A Glock is not going to get through reasonable body armor, like an AR-15 can. Glocks are really not designed for a high rate of fire like AR-15's are.
There is one thing that makes a Glock better than an AR-15, it is easier to carry. If I am a soldier, I know I am going out to kill someone, so I want to carry something like an AR-15. If I am a hunter, I know I am going out to kill something, so I want to carry something like a hunting rifle. If I am anyone else, and do not know I am going out to kill anything, I want to either not carry any weapon, or at most carry a pistol.