A sheriff usually does have a higher ranking and usually more powers than a police officer in some places.
The main difference between a sheriff and a police officer is that a police officer is usually just responsible for the prevention of crime within their city limits but they can also arrest people as well.
Sometimes a police officer may be called out to another town to assist the sheriff in a crime to capture a criminal etc.
A sheriff has more powers usually than a regular police officer and the sheriff is responsible for an entire county, which could include multiple small towns and several larger cities whereas a police officer is only responsible for the city limits they are hired in.
But both police officers and sheriffs can be called out to prevent crime in both places.