NSAIDs work by inhibiting the enzyme cyclooxygenase, which prevents the formation of prostaglandins involved in inflammation, pain, and fever. They are metabolized in the liver and their half-lives determine dosing regimens, with longer-acting NSAIDs increasing risks. NSAIDs should be avoided in patients with aspirin sensitivity or asthma, as they inhibit the same enzyme and can cause similar reactions. NSAIDs differ in their selectivity for the COX-1 and COX-2 enzymes, with non-selective NSAIDs inhibiting both and posing greater risks of gastrointestinal and platelet effects.