opiate analgesics have a narcotic added into a pain reliever. The narcotic binds to pain receptors in the central nervous system. This also produces central nervous system depression.
NSAIDS inhibit prostaglandin synthesis, which promote swelling and inflammation. NSAIDS inhibit the production of these, therefore, they help with the swelling and inflammation that accompany the event that precipitates pain.
Each pain reliever has its pros and cons.