The word соба́ка is general. A dog can be called собака even if it’s known it is male.
The word пёс can sometimes be used to refer to a dog whose sex is not known (more rarely than собака though).
There’ş also a word кобе́ль — ‘a male dog’. Like су́ка, it is used mostly by dog-breeders and can be used as an offensive word too (‘tomcat’ (?), ‘sleazebag’(?), don’t know how to say it in English).
It’s the word кобель that means a definitely male dog.
A similar thing is with horses.
Both ло́шадь (grammatically feminine) and конь (grammatically masculine) can be used for horses of both sex.
Ло́шадь is more general, while конь is a bit rarer.
If you want to tell about a horse’s sex, you can use words кобы́ла ‘female horse’, ‘mare’; жеребе́ц ‘male horse’, ‘stallion’; ме́рин ‘castrated male horse’, ‘gelding’.