Laundry Evangelist Patric Richardson prefers vinegar and Borax. Borax and vinegar are powerful antifungals.
Longer and hotter, the better, run a cup of liquid chlorine bleach. Wipe the door and gasket with 1/3 cup bleach in 3/4 gallon water after the cycle.
Vinegar saves washing machines. It works without Borax or baking soda. Sprinkle roughly a cup of baking soda in the drum, then add vinegar.
A wet, humid environment, such after washing clothing, works nicely. Leave the washing machine door open to let air circulate in the drum.
Dog and cat hair adheres to the inside of doors if you have pets. Pet hair and other fibres absorb water, so wipe the door
Newer washers self-clean. This mold-removing cycle uses hot water and a specific spin. If your model lacks this cycle, use bleach, vinegar, and Borax.