My dishwasher doesn't drain properly

The tub fills up and starts coming out the bottom of the door and isn’t draining at all but when I press cancel and drain it pumps right out .

Sounds like you might have a bad float switch. First check the float in the front right side and make sure it is not stuck. If it is free the go to the bottom and check the switch with a multi-meter for continuity. NC should be closed and NO should be open. If it reads bad replace it. Here is the part number along with the parts diagram. Hope this helps.
AP6015000
Tub assembly replacement parts for WHIRLPOOL DU948PWKQ1 | AppliancePartsPros.com

Thanks I will try that in the morning, it makes sense.

Your welcome. Let us know how it turns out.