Is it possible to change the resolution or DPI of the Nexus 5? I've read somewhere that you can do this with a Nexus tablet. I will be needing an Android device for development and I am considering the Nexus 5.
Well, you can't change the actual screen size or DPI, because those are physical characteristics of the screen hardware. You can't stretch the phone to be the size of a tablet, or change how the LCD is wired.
On a rooted device, you can edit a configuration file to change how big Android thinks the screen is, which will affect the calculated DPI and the resulting layouts. That isn't convenient for testing, though, because rendering a "larger" screen's UI on a smaller screen will result in tiny text that's hard to read and tiny touch elements that are hard to interact with.
For testing a variety of screen sizes, you're better off creating a variety of AVDs in the emulator. That's much simpler and less dangerous than rooting and editing low-level system configuration files just to test a layout.
You can safely change the screen density (DPI) in your build.prop file using a tool like Build Prop Editor. Note that you will need a rooted device in order to tweak your build.prop. You will want to change the 'ro.sf.lcd_density' key to a smaller value to make everything smaller (higher density); likewise, you will want to change it to a larger value to make everything bigger (lower density). I recommend you stay within the range of 100 - 600 dpi, as that covers almost all devices out there.