If the dog isn't given enough medicine to put them to sleep then it's possible the dog could wake up from euthanasia but it's very unlikely.
The vet will give the dog a relaxation medicine first and then they will introduce seizure medicine at a lethal enough dose which causes the heart to fail.
Then the dog dies and it's a very peaceful way for the dog to go.
Having the dog euthanized at the vet is much better than letting the dog die at home in pain.
The dog is gonna eventually die anyway and if you can afford to have the vet put the dog to sleep it's better to do it that way.
The dog won't suffer then and will die peacefully.