As long as you use proper toilet facilities there is no risk of either passing them to anyone else or self infecting with more worms.
To become infective, hookworm eggs must leave the body (passed in faeces). Under optimum conditions the eggs then hatch and the larvae grow in the soil, molting twice before being able to infect a person whose skin comes in contact with the larvae.
Similarly, whipworm eggs are only infective after they become embryonated, under the right conditions, outside the body.