Build up of gunk in the machine - you need to disassemble anything which comes out, stick it in the bath and scrub it with very hot water and some kind of detergent. It's an absolutely disgusting job and if you've never done it the smell might make you retch. If the stuff has a slimy film on it which doesn't come off easily, that's a biofilm - it needs boiling water and some friction to remove.
Things to look for - the filters, which usually separate into two or three parts, also (carefully!) put your fingers down into the hole where the filter sits and check that the little fan thing turns properly. Be careful, because bits of broken glass or other sharp things can be stuck in here.
The door seal - that's always a disgusting one. Don't take out the bottom seal where the hinge is unless you can find a YT video confirming you don't have to remove the whole door to replace it, but the seal around the edges and top should come out and go back again easily.
The spinning arms. The top one usually has a cap to unscrew, the bottom one usually pulls up. Again youtube will help. There are often things like seeds and bits of spinach and eggshell stuck inside here - pipe cleaners stuck through the little holes can help you dislodge them and push them back towards the big hole in the middle.
For even more grot/advanced ick:
Some models of dishwasher the whole plastic piping that connects the bottom to the top can clip out, to clean behind.
Take the drawers out, the wheels sometimes have gunk build up and don't turn very well, you might also want to poke around with the sliding metal parts the top drawer rests on - sometimes this comes out too. Mine was full of some unimaginably disgusting paste which made me heave.
If you can't take those things out, try using a pipe cleaner or very thin cloth or a cocktail stick pushed behind those things, or a jet of water if you have a way to do that, to dislodge grotty old food residue.
For ongoing maintenance:
Clean the filters regularly e.g. once a week. Don't expect those "4-in-1 tablets" to actually replace the need for rinse aid and salt. You need both, or just switch to a basic powder/liquid and add separate rinse aid/salt. Check manual and adjust dosing level of salt to your water hardness (not usually needed unless white salty-tasting residue is being left, or very hard water area). Clean the spinning arms about once every 1-2 months.
I usually do the cleaning cycle with the cheap cleaning tablets about once every 1-2 weeks, after rinsing the filters with some hot water and washing up liquid, and then a cleaning cycle with the bottle type cleaner after cleaning the arms.
Dishwashers are truly disgusting but I hate washing up even more than I hate the idea of whatever the dishwasher is doing to the glasses, so I will live with it.