Dogs do not feel any pain when they are put to sleep and euthanized.
The vet when they euthanize the dog or put the dog to sleep administers a drug through injection that sedates the dog first so they are asleep.
Then another drug is injected that stops the heart and then the dog dies a peaceful death and does not know it because at first the dog is put to sleep so they are unaware of it.
Then the second injection causes the actual death in the dog so they die peacefully and without any pain.
A good vet can make it a very peaceful procedure for the dog and you.
Having a dog put to sleep and euthanized costs only around $50.00 to $100.00 depending on the vet so it's not all that expensive.