Take a breath here and look at what you have.
The sink has shut-off knobs for both the hot and cold water… to the faucet. There should be separate shut-off/s to the dishwasher inlet, which probably feeds from the hot (and cold?) water inlet to the faucet. Shutting off the water to the sink doesn’t automatically shut off water to the dishwasher unless the dishwasher outlet leg is downstream (which, under the sink, paradoxically means “above”) the shut-off valve. Do you understand that so far?
That doesn’t seem to be the problem, though, because you say “water from the sink is running into the dishwasher and spilling”. Water from the sink should NEVER run into the dishwasher. In fact, there should not even be circuitry that allows that. Water from the sink runs down the drain. Water from the dishwasher drains, also. They drain into a common drain pipe, but they don’t drain “one into the other”. Something is wrong there, either with your hookup or (more likely) your description.
When you open the sink drain, what happens, exactly?