my male dog had what looks like puss coming out of his penis occasionally. is this normal for a 6 to 7 month old pitbull

my dog is a male and a few times i noticed there was some puss on the tip of his penis. How does this happen? is it normal? How do i stop it if its bad? Is it harmful?
also, could it have to do with the fact that no matter how much we try to stop him from getting in it he is just obsessed with getting to the cats litter box, or that were having major trouble trying to get rid of his worms?