Most drugs are eliminated from the bloodstream by the kidneys, so the drug or its breakdown products can be found in the urine, usually for some length of time after the drug was taken into the body. Consequently checking a urine sample will show if the individual has used drugs in the recent past.
Urine samples are commonly used because they are non-invasive; there is no risk of infection as there would be with taking a blood sample. Anyone can collect a urine sample for testing, and no special equipment is required. Blood samples should only be drawn by a trained medical practitioner, and sterile needles and proper disposal facilities for the needles are necessary. The analysis of a urine sample is also simpler than that of a blood sample, which has to be treated to separate the cells from the liquid portion of the blood before the testing can be done.
Hair analysis can also be used to detect the presence of drugs in the body and has the benefit of being non-invasive. It also costs relatively little and has "the ability to measure a large number of, potentially interacting, toxic and biologically essential elements" (Wikipedia). While it has been increasingly used in court systems and by private employers, it is still not as widely used as urine analysis, possibly for the fact that urine testing can be done instantly with on-site instant drug testing measures.