When a headache, back pain or other complaint strikes, many people believe Advil, Tylenol and other over-the-counter analgesics are pretty much interchangeable. Far from it.

These medications are each at their best when taken for certain ailments, in part because they work differently in the body and can have different side effects.

Got a headache? Tylenol, or its generic version acetaminophen, might be your best bet since it comes with fewer side effects, many experts say. Inflamed elbow? Advil, whose active ingredient is ibuprofen, is likely to bring greater relief. And if you’re trying to bring down a fever, either medication will probably work, although some studies have found Advil to have a slight edge.

Both medicines are largely considered safe. But taking too much acetaminophen can damage the liver. And ibuprofen is part of a category of medicines called nonsteroidal anti-inflammatory drugs, or NSAIDs, that can cause gastrointestinal problems such as upset stomach and internal bleeding. Other types of NSAIDs include Motrin, which also contains ibuprofen; aspirin and naproxen, which is in Aleve.

One solution for people needing an analgesic often, such as children with high fever or adults with intense pain: Alternating ibuprofen with acetaminophen can provide greater relief and minimize side effects.

The medications, which are taken by millions of Americans every week, continue to be studied for other possible side effects. A recent study published online in the journal Psychological Science found that acetaminophen may blunt people’s emotional reactions. The researchers plan to study whether ibuprofen has the same effect.

Click for more from The Wall Street Journal.