JdBo, simplified it nicely. When given by injection anesthetics have what is known as a hypnotic effect when an adequate dosage is administered. They put you into a deep form of sleep in which you do not have a sensory perception of pain or what is going on around you. Analgesics will dull pain but the dose required to perform surgical procedures with opiates would be so high that respiration and heart rate would be too greatly depressed.
Some anesthetics are derived from opioids such as morphine. It's used in various concentrations to numb pain. Other pain meds don't have the opioid base that blocks pain, but use different chemicals that attach to the pain receptors in your brain. Tylenol, Aspirin, Ibuprofen, Nonsteriodal Anti Inflammatories, and the like. They can be effective if the pain is small, but usually the big opioid derivatives are brought out if the pain is great, under a doctors watchful eye of course.