Narcotic drugs are used for medical purposes and function by connecting with opioid receptors in cells to relieve pain.