I have been drinking lots of black coffee for most of my adult life, and I can still sleep well. I'm lucky that way. Both of my parents were good sleepers, and my Dad drank lots of coffee too.
Neither of my parents had dementia though my Mom lived to 99. My brain is still working well at 82, so I trust that coffee is having a positive effect on me.