Particularly with dwarves, density is something to be considered very carefully. Dwarves do not hunt their food.. they just hitch and wait for it to drift past close enough to reach so the amount you feed has to match the tank, not the number of dwarves - if you don't have enough dwarves in the tank to eat it you have alot of uneaten bbs. I have had 36 dwarves in a 5 gallon and that worked pretty well. I have had 58 in a 10 gallon and that works fine right now I have about 25 in the 5 gallon and about 35 in the 10 (hard to keep count of the fry).
Also, if you put 2 in a 5 you won't even be able to see them much. Two would be much better in a 2 gallon or so - that's what I'm going to set up for my granddaughters.
Hydroids are killers - I lost my first entire herd to hydroids. I currently use sand and live rock and live macro and snails but everything in the tank is treated with Panacur for 3 days before being added - the only exception is the bbs which are decapped with bleach to avoid hydroids - take this threat seriously with dwarves. And if you do use panacur do some research on it too.. it kills many snails, corals, stars, etc.