What is the longest somebody can live with a family member with dementia?

It depends. There is no set answer. You can live with a person with dementia until your health or the health and safety of the person with dementia are at risk. It is definitely a difficult decision to make.
Tolerance resources. It will depend on the rate of decline and the availability of help. Medications slow the rate of impairment and caregivers may be available through other agencies.