Also, make sure you are not putting too many clothes in at any given time. I used to smell an odor when it seems this was the culprit. Another solution, every 7-10 loads, run your washer without clothes and only use bleach. This rids of contaminants, debris, all kinds of leftover residues. This has made a big difference in my laundry chore.
As far as the best detergent, I say hands down, Gain - not only does it smell good ( soothing sensations lavender my fav) but it cleans and deodorizes well. Also, Downy any of the simple pleasures (lavender, of course a favorite) and if you're looking for an inexpensive yet effective dryer sheet better than (in my opinion) bounce, try the Arm and Hammer Vanilla one and/or Suavitel Aroma sensations (lavender) of course.