As marcus said there are both theoretical and observational astronomers and cosmologists (with many people somewhere in between in both the theory-observer as well as astronomer-cosmologist spectrum).
The way I would put it is that an astronomer generally wants to look at some class of objects to learn about them for the sake of learning about them. So an astronomer working on stars will use telescopes to look at them and/or do theoretical modelling of them with the end goal to understand more about stars. The same applies to people who study galaxies, pulsars or whatever.
On the other hand, cosmologists need to use the enormous wealth of knowledge that astronomers have built up about the nature of the objects (stars, galaxies etc) in the Universe, but they use that knowledge to address broader questions about the Universe. There is a lot of overlap though, for instance to use galaxies to do cosmology, you need to do a lot of detailed thinking about the nature of galaxies, and hence simulations or observational surveys are often done with large groups of people, some of whom are ultimately wanted to study the galaxies themselves, while others just want the galaxy bit to be understood so they can use the results to infer things about cosmology.
On the other hand, you often have to assume a cosmology when you want to say something about for instance the evolution of galaxies. The two go hand in hand and it is somewhat a case of one person's noise is another signal...