"Water flows fine" where? Into the drain?? Into the dishwasher? Sprays around inside the dishwasher?
** but after 5 mins, the dishwasher does not wash. **
The dishwasher should wash (ie. spray) regardless if it was draining or not. It just might not clean very well, continually recirculating dirty water.
If it isn't draining check out the drain but if the symptoms are just not spraying (washing), get more details of the problem (sights, sounds, etc.) and post them along with the machine's brand and model number and we may be able to suggest areas of the dishwasher which might need attention.
You can find tips for locating the model and serial number identification tag on your appliances at the following link: