Only Anticholinergic drugs appear to be associated dementia (but as noted the evidence is very weak).
Older first generation antihistamines such as Diphenhydramine (Benadryl), Doxylamine (Nyquil) have substantial Anticholinergic activity.
A lot of the second generation antihistamines have no significant Anticholinergic activity, eg. Azelastine.
Benadryl and Nyquil are terrible drugs. Why they haven't been phased out is beyond me. At least Azelastine is now OTC in the USA.