Taking over-the-counter medications for colds, flu and allergies may seem harmless, but a new study warns that certain drugs are linked to an increased risk of dementia.

The class of medications, called anticholinergics, are sold over-the-counter and by prescription for many chronic conditions. They include sleep aids, hay fever pills, and flu symptom relievers.

Anticholinergics work by blocking a specific neurotransmitter in the brain and body, said Dr. Alexandra Sowa, an internist and clinical instructor at Weill Cornell Medical College.

"This class of drugs covers many things -- everything that treats insomnia, depression to COPD and bladder problems. It is a very common medication, so it's in many people's medicine cabinets," Sowa told CBS News.

Get Breaking News Delivered to Your Inbox

Anticholinergics include antihistamines, anti-psychotics, anti-vertigo drugs, cardiovascular and gastrointestinal drugs, and muscle relaxants, according to the Centers for Medicare and Medicaid Services.

Some commonly used anticholinergic drug brands include Benadryl, Tylenol PM, Advil PM, Dimetapp, Dramamine, Paxil, Unisom, the opioid pain medication Demerol, and the bladder drug Vesicare.

The new study, published in JAMA Neurology, looked at some of the side effects that have been known about for a decade, and one of them is cognitive impairment.

Researchers from Indiana University School of Medicine studied about 500 older people whose average age was in the mid-seventies, and who did not have a previous history of dementia. They conducted cognitive testing on the participants, evaluating simple memory recall, and they looked at higher cognitive function such as math skills and decision-making ability.

"What they found was that people who took this medication had higher rates of cognitive impairment," Sowa said.

But what makes the study different from previous research is that the scientists also scanned the participants' brains.

"They actually found physical changes that were different in these patients from other patients who weren't on this type of drugs," Sowa said.

The drugs can be easily purchased at pharmacies and grocery store chains.

Mike Tringale, a spokesperson for the Consumer Healthcare Products Association, which represents over-the-counter drug makers, told CBS News, "It's important to help people understand the science without creating hysteria."

He said over-the-counter products are only approved for short-term use and that the study didn't look at how long people were taking them or the dose.

"There were some missing pieces," he said

"It is important to remember that the active ingredients are approved by the U.S. Food and Drug Administration and recognized as safe and effective when taken as instructed on the product label," Tringale added.

Sowa said, "The takeaway here is that just because it's over-the-counter does not necessarily mean it's safe for you to use long term. I want everyone talking to their doctor if they're using any of these medications on a regular basis."

People need to know what's in their medicines, she said. "They have side effects and there may be increased risk down the road of significant cognitive impairment. We can't say that one causes the other, but we're now starting to see increased rates of association."

"We know based on previous studies that as little use as 60 days, or even 90 days non-consecutively over the course of a lifetime, can be associated with these risks. It's not every night for 30 years, it's sometimes or sporadically," she said.

Sowa said many patients come to her and don't even mention over-the-counter medicines they're taking when she asks about their medications. She said be sure to tell your doctor about risks factors such as a family history of dementia, and to consider alternatives.

"Just because medication is easiest, doesn't necessarily mean it's the best. So when it comes to difficulty sleeping, there are lots of holistic techniques," se said.

Alternatives to sleep drugs, for example, can include good sleep hygiene -- turning off the television a few hours before bedtime, getting more exercise and cutting back on caffeine. Sowa also recommended trying cognitive behavioral therapy for better sleep.

"It's retraining your body how to fall asleep," she said.

And when it comes to allergies, there are many alternatives to Benadryl, an anticholinergic and so-called first generation antihistamine. Second- and third-generation antihistamines, including brands such as Claritin, Zyrtec and Allegra, are not anticholinergics. But talk to your doctor before switching to a new drug.