OP, can you tell us the make and age of your dishwasher? Does it have a built-in disposal? Is it attached to a sink with a disposal in it?
I have a 13 year old Maytag Jetclean dishwasher that came with the house. I can tell it's not a deluxe model, even for the time it was manufactured, it's just fairly good. Most of the time, my dishes come out sparkling and residue free UNLESS (a) I'm out of JetClean in the reservoir, (b) I used a non-Cascade Complete or Kirkland detergent - which i suspect is Cascade in disguise, (c) the disposal in the sink wasn't run immediately prior to the dishwasher running and stuff was stuck in it (d) paper or plastic bits were stuck in the water jet holes in the dishwasher itself (perhaps from washing jars with labels on them? We have started running a quick rinse cycle in the dishwasher, after putting our scraped-off-but-not-rinsed dishes/pots/pans in and that has helped (since it was working a little less better than previously).
Meanwhile, my SIL has a diswasher that is extremely deluxe, bought two years ago, cost over $1000 new and is a LEMON!!! The thing leaves crap, residue and everything else ALL OVER THE DISHES. It's awful. She actually brought a couple of plastic glasses over to our house one time when visiting (after using them in her car) and one simple run through our dishwasher with the rest of our dishes removed a dark tea residue in the plastic that she thought was permanent. SIL and BIL THOUGHT their dishwasher was doing a great job, but I swear, I think they just thought that because of how fancy and expensive the dishwasher was. I'm guessing that other dishwashers of the same make/model work much better but that they just got the worst one of the bunch.
Now, our 13 year old dishwasher is far from perfect. Previously, we had bought a portable dishwasher from Sears (Kenmore) for $450 (many years ago, perhaps 12) and that thing would perform like in the commercials, where they put a plate with an entire cake on it and the cake would disappear and all the dishes would be sparkling. It didn't matter what sort of detergent we used; dishes would come out PERFECTLY.
In conclusion (yes, this one's long, sorry, lol), I think that you need to get a dishwasher with a built-in disposal/garburetor, you need to run your in-sink disposable/garbuteror first, and you need to use a good detergent and hopefully, have an on-board heater or at least run hot, hot, hot, water in the sink before starting the dishwasher. You also need to be lucky and not purchase a lemon (I suppose a replacement warranty can help with that).