Was it hard to find someone to be a Sheriff in general or lots of people wanted the job? Or did it depend on each territory? (let's say in a dangerous mining town with lots of gambling no fun to be the Sheriff)
Written histories - like newspapers, novels, and movies/TV - do not spend a lot of time on the days when nothing happened. That said, during most days, nothing happened. People attracted to mining towns with rising prosperity had better things to do than to engage in violence. Being a sheriff was a publically-paid position and it was coveted. If the town was incorporated, it would typically also have a chief of police. And there might be a federal marshal if the population was big enough. Analysis of crimes committed in mining towns reveals that early-on arrests were usually alcohol-related. Some involved weapons, but even in these cases, someone was usually drinking. There was robbery and an occasional murder, but law enforcement was typically not endangered (although I have read accounts of police officers injured while breaking up fights). As the mining town aged - assuming it did not disappear - crimes began to shift to adolescent hijinks, and drinking lessens. Again, law enforcement faced little risk.
The motif that often appears in Westerns - of a town without a sheriff because the criminals have taken over - was not typical. I'm sure historians of law enforcement in the West would be able to think of an example, but I don't know of any with my field of vision.