First, scoop up the poop or soak up urine by blotting with coffee filters or paper towels.
On carpet, rinse the area with water or club soda to dilute the urine, then blot again with a clean towel.
It helps to apply pressure with a stack of books and then wait for all the moisture to be absorbed.