The only way to know for sure what is happening with this dog is to take him to a vet.
He is in pain (that is why he wants to bit when you try to touch), and it sounds like he has an infection (the runny puss). With Westies it is very likely that he had impacted anal glands which burst and now are infected. This would make his back hurt for sure!! It would also smell terrible.
So, get him to a vet as soon as possible and get him the help he so desperately needs!
Vomiting can be for many reasons.
Upset stomach? Could he/she have gotten into anything? Ate something they weren’t suppose to?
We recommending withholding for for the day and starting to then feed small amount if they seem to be improving.
Next steps would be radiographs to confirm whether anything seems odd, and sometimes sending out a blood panel to check levels.
Let us know if you have any questions!