How can I stop my dependent from putting himself in dangerous situations?

Wandering in elderly. It would depend on the disease the person had. If it is dementia, then using door handle covers would help them from leaving the house. Giving the person a task and redirecting them also may help. Some medications will help if anxiety is associated with the dementia.