Opioids such as heroin, fentanyl, raw opium, and morphine have become a serious threat to the world population in the recent past, due to their increasing use and abuse. The detection of these drugs in biological samples is usually carried out by spectroscopic and/or chromatographic techniques, but the need for quick, sensitive, selective, and low-cost new analytical tools has pushed the development of new methods based on selective nanosensors, able to meet these requirements. Modern sensors, which utilize "next-generation" technologies like nanotechnology, have revolutionized drug detection methods, due to easiness of use, their low cost, and their high sensitivity and reliability, allowing the detection of opioids at trace levels in raw, pharmaceutical, and biological samples (e.g. blood, urine, saliva, and other biological fluids). The peculiar characteristics of these sensors not only have allowed on-site analyses (in the field, at the crime scene, etc.) but also they are nowadays replacing the gold standard analytical methods in the laboratory, even if a proper method validation is still required. This paper reviews advances in the field of nanotechnology and nanosensors for the detection of commonly abused opioids both prescribed (i.e. codeine and morphine) and illegal narcotics (i.e. heroin and fentanyl analogues).