Dementia does not come on rapidly. UTI can lead to Delirium which is an emergency event and must be diagnosed quickly.
I wrote and article on this with how to check for Delirium.
912superseniors/mental-impairment-delirium-vs-dementia/