Welcome to Just Answer. I'm gonig to be very honest here and say that it sounds like your little guy is having a life threatening emergency situation. If he is trying to urinate and vomiting, then he most likely has a urethral obstruction and this is life threatening.
Here is a link on this. Please have him seen immediately as this again sounds very worrisome!
Okay well both of my cats have been going to the restroom really well and they eat urinary tract formula. The other thing is that is that he has had an issue like this before without the vomiting and every time I take him to the vet, they give me metronidaz and fortiflora to give him for like two weeks. He will be fine for like 2 months or less and then he gets sick again