First question should be what is your main purpose for the gun? If it is for home defense and target shooting, the longer gun will be easier to shoot more accurately due to the longer sight radius. You will also get slightly more velocity out of the 5 inch. Over long distance, the extra inch may also improve accuracy slightly. Unless you plan on shooting at long distances, the accuracy difference is pretty much negligable.
If you plan on getting a concealed carry permit, you might want to go with the smaller gun since it is easier to conceal. The slide length does not affect overall concealability as much as grip length (unless you carry horizontally in a shoulder holster). If the grip is long (Glock 17 vs. Glock 26) it makes strong side carry (on the side of your body) pretty difficult since the butt of the gun will stick out. If you carry IW (inside the waistband) SOB (small of the back) barrel length comes into play since a long gun may reach your spine, making it uncomfortable to carry. Personally, I can't stand IWB SOB carry since I find it uncomfortable as heck. If you live in a cold climate and frequently wear a jacket, you can conceal pretty much any handgun
I hope that helps you rather than confuses you. Good luck.