I think most dishwashers have a pretty good dry cycle that gets the internals of the dish washing compartment up to temps that kill most bacteria, mold, or anything that would end up stinking in a closed off environment over time. Additionally, by the time you unload the hot/warm dish washer, the majority of the residual moisture in the compartment has evaporated due to the higher temperature of the water.
Conventional clothes washers on the other hand don't typically get to very hot temperature at any point in their cycle. Even though hot settings can be used for the wash cycle, no temperature is ever reached that could dry the clothes or fully dry the drum and any internals that are wet. Once the cycle is complete, the wet clothes are put in the dryer to complete the job and the washing machine is left sopping wet, likely with pooled water in the bottom most parts that contain live organisms and plenty of dead skin to live on. If you seal that off by closing the door, the water doesn't have a chance to evaporate so it turns into Primordial Soup waiting the start sentient life.
We made the switch to this large capacity washer/dryer combo several years ago and I don't think we've ever been more happy with an appliance purchase.
https://www.homedepot.com/p/LG-Electronics-27-in-4-5-cu-ft-Black-Steel-Ultra-Large-Capacity-Electric-All-in-One-Washer-Dryer-Combo-WM3998HBA/313550124
These all-in-one washer/dryers have been around for a while and they're very popular in Europe, but this is the only one that we've found that takes the same amount of clothes as a normal load you would do with a standard washer dryer. The all-in-ones work in a pretty similar way to dishwashers with their dry cycle. The clothes go through a normal wash and the spun well to get as much water out as possible. During the dry process, the machine heats the drum and clothes up to a pretty high temp while circulating air within the machine past a heat exchanger that condenses the humid air and pumps out the condensed water to the drain. The end result is clean clothes that are pretty warm/hot, but since the machine is vent-less, they're not "100% dry" right when you open the door. But since the moisture is warm in the clothes, it evaporates immediately upon taking the clothes out. Since the machine gets to pretty high temps during the dry cycle, I think it sanitizes everything and there's no chance of weird smells developing if the machine is left closed. We've even thrown clothes in, run a cycle so the clothes are washed and dried, we went out of town for several days, then when we get back we pulled the clothes out and they were dry and smelled super fresh.
With our all-in-one washer dryer, we always keep the door closed, and it doesn't get funky.
Edit: just saw @manassehkatz-Moving 2 Codidact's response conclusion and realized we were talking on the same line. I agree, the main difference between conventional clothes washers stinking and dishwashers not having an issue is just the difference in heat reached during their cycles.