This article is reprinted by permission from NerdWallet

The cost of prescription drugs in the U.S. can be enough to make you sick.

What you pay varies enormously depending on the drug, the pharmacy, your insurance plan and your deductible, among many other factors. A drug that may have been cheap or at least affordable the last time you filled it could be far more expensive or not covered at all the next time.

Often, people have no idea what a prescription will cost until they get to the pharmacy counter, says Leigh Purvis, director of health care costs and access for AARP’s Public Policy Institute.

Still, finding a way to afford your meds is important. People who don’t take medicine as prescribed because of the cost could wind up sicker — or dead.

“What is a potentially relatively small problem today, like high cholesterol, could turn into a much bigger problem like a heart attack down the road if you don’t treat it,” Purvis says.

Check with your doctor and insurance plan

Your doctors may not know what your medications cost you, since they’re dealing with dozens of insurance plans with different formularies, or lists of drugs, and how they’re covered, Purvis explains. In addition, insurers may strike deals with certain pharmacies, so a drug that costs $60 at one could cost $160 at another.

If affording a drug is a challenge, your physician may be able to suggest alternatives, such as a generic or a different type of medication. Two other questions you can ask: whether a medication you’ve been taking for a while is still necessary and what lifestyle changes might reduce or eliminate the need for prescriptions.

If you have insurance, review your drug coverage options carefully each year at open enrollment — that yearly period in the fall when you choose your health insurance for the following year. Make a list of all your medications with their dosages, and check how those are covered by each plan. Insurers regularly change their formularies, so you may need to switch plans to get the best coverage. And even if your drugs are covered, you’ll typically have to pay out of pocket for prescriptions until you meet your deductible.

Your insurer or pharmacy may offer a mail-order option to reduce costs, but don’t assume that’s your best option. Shopping around could deliver significant savings.

More: Inflation is making some seniors choose between food and medications — what you can do

Look at online prices

Start your search online. The number of online pharmacies has exploded in recent years, giving you many more opportunities to save.

Amazon AMZN, +3.20% launched a full-service pharmacy in 2020, joining more established dispensaries, such as Costco.com COST, +3.27% and HealthWarehouse.com HEWA, +0.56%. Besides those, several limited-service startups — including Cost Plus, GeniusRx, Honeybee, Ro Pharmacy and ScriptCo — offer deals on generic drugs.

The startups usually don’t take insurance, but their prices can be less than the typical co-payment, according to Consumer Reports. For example, the consumer research organization found that a 30-day supply for 20 milligrams of atorvastatin — a cholesterol drug — ranged from $14.60 at Amazon and $13.99 at Costco.com, to $3 at Honeybee and just 54 cents at ScriptCo. By contrast, insurance copayments for workers with prescription drug coverage averaged $11 to $12 last year for the least expensive drugs, including many generics, according to KFF, the nonpartisan health care think tank formerly known as the Kaiser Family Foundation.

Your savings may be offset by membership fees: Amazon’s Prime membership — which you’ll need if you want the lowest prices — is $139 per year or $14.99 per month, while ScriptCo charges $140 per year or $50 per quarter. Costco has a membership fee of $60 a year, but you don’t need to be a member to order prescriptions online or at its warehouse stores.

Also read: Retirees on edge over inflation and stock volatility can take these 5 steps

Investigate other discounts

GoodRx has a website and an app that allows you to compare prices at nearby chain pharmacies, and it provides free coupons that can save up to 80% off of the list price. You’ll find another price comparison tool that includes local pharmacies at NeedyMeds, a nonprofit that helps people find drug manufacturing discount programs and other ways to reduce medication costs. In addition, several chains including Walgreens WBA, +1.09%, Walmart WMT, +2.43%, Kroger KR, +0.82% and H-E-B have discount programs.

One often-overlooked alternative for Medicare beneficiaries is the Extra Help program, aimed at helping older people with limited incomes and resources pay for their medications, Purvis says. You can apply online or by calling 800-772-1213.

Watch out for drug interactions

Finding the best prices can take significant time and effort. And people who shop aggressively for the lowest cost drugs could face a hidden risk if they’re getting multiple medications from different pharmacies, Purvis warns. Without a single pharmacist overseeing their care, they risk potentially harmful drug interactions.

Read next: As we age, do we get happier or sadder?

You can use an online drug interaction checker like the one at WebMD, but ideally you would ask your primary care doctor or a pharmacist to review your full list of medications at least once a year.

“Making sure that somebody has an eye on the big picture care is really important,” Purvis says.

More From NerdWallet

Liz Weston, CFP® writes for NerdWallet. Email: lweston@nerdwallet.com. Twitter: @lizweston.