>>412457828 mm:
- Cheaper (both new and used)
- Easier to use for quick point and click shooting since you're capturing more image at a given distance so don't have to be so precise with framing and can crop composition in post
- Better in crowds or tight spaces or narrow streets or wide landscapes, etc
- Better macro focus range. 6 cm vs 12 cm
- Better snap focus
- A couple of millimeters thinner so more pocketable
40 mm:
- Typically better in-camera composition. It's easier to fill the fram and pictures will normally look more "natural" in the 40 mm framing at a comfortable shooting distance and since you typically don't have to crop as much, you can make larger prints without upscaling the images
- Don't have to get as close to your subjects which is good if your shooting people on the street etc and don't wanna get in their face
- Less lens distortion so (on paper at least) slightly sharper edges
Overall the 40 mm will offer better shots straight out of the camera with a fov that is more similar to what the human eye sees and it's a more natural distance to snap photos at; but the 28 mm is way more versatile and just gives you more image to work with in post at any given distance.
However, be prepared to crop the 28 mm a lot if you plan on shooting people in street photography though, unless you don't mind walking up right next to them. To compose people inside photos you can usually be like 3-5 meters away with the 40 mm without getting too much clutter inside the frame, but with the 28 mm then you're basically walking up within a couple meters like, "Hi. *click*". And obviously most of those photos will be of people staring at you like, "Wtf??? Who are you and why are you inside my personal space, faggot??? Did you just take a picture of me, you fucking creep???"
So it depends. I'd say maybe grab the 40 for what I described above and the 28 for everything else. The 40 is more of a specialized street photography ninja-camera.