With people? Under the right circumstances, yes. If it prevents someone from suffering a long drawn out illness that they cannot recover from, I think so. Did you know dementia patients not only lose the memories of their life, but they can also lose the ability to do things that are automatic to the rest of us. They forget how to walk, or brush their teeth. Their body can fhings like how to swallow pr how to control their bladder or bowels. They essentially starve to death while wearing a diaper.
I would rather someone would have the choice of being euthanized rather than suffer through that or any other similar fate.