The Nexus 5 is clearly ahead here. For between $349 and $399 you get an unlocked phone with no contract. If you wanted to buy an off-contract Galaxy S4, you'd have to fork over $600 or more.
Both phones are excellent, with no clear winner. If you care about storage, and you use a camera in your work, you'll probably want the Galaxy S4. If you like TouchWiz, you'll want it as well. But for most other purposes, and especially if you're budget-minded, you'll likely go with the Nexus 5.