Generally speaking a police officer's official duties are limited to within their jurisdictional areas of responsibility. That being said, they DO (as does any other civilian) have the right to detain an individual whom has committed a crime outside of their jurisdiction pending the arrival of appropriate law enforcement authorities within the area outside of their jurisdiction. Detainment of a subject is not the same as arresting the subject, likewise they cannot and will not for example ticket individuals outside of their jurisdiction.
The exceptions are for example in the event of a pursuit of a suspect that crosses jurisdictional borders, they will contact the authority over that jurisdiction and continue pursuit at their discretion, if the subject is taken into custody prior to the authority of that jurisdiction arriving on scene, they generally will wait and hold them until they may arrive. Usually the subject of the pursuit is returned to the jurisdiction in which they originally offended. Sometimes they are processed within the area they were caught, then transferred at a later date. Alternatively, some areas DO have mutual-assistance programs where authorities from outside of their jurisdiction are permitted to enforce the law within due to lacking resources locally.
Generally this is a list of how most systems work within the structure of police forces accountability (note I am not listing every type of police nor will I be).
Federal-interstate related issues (IE someone crosses state or country lines to commit a crime or violates federal statutes) The FBI for ex deals with the interstate related issues, if you were to rob a bank, they are FDIC insured, it falls under the fed. If you were to commit a crime in say California, and flee to Nevada, where you commit another crime, the FBI can take jurisdiction over your pursuit.
State-State Police/State Troopers/etc are generally inter-county/highway patrols that are assigned mostly to support unincorporated rural communities along with the highways and other major roads within the state, sometimes they are also used to augment municipalities forces that are lacking, but that is far more rare than supporting rural communities with lacking forces. Generally Traffic cops and Traffic accident cops.
County-In most of the country County Police make up the bulk of the police enforcement duties, they deal with most of the normal calls that you expect police to handle.
Incorporated City Police-Like the county they handle the bulk of normal duties, but are generally for cities that are incorporated like Washington D.C., NYC, LA, etc.. Mostly densely populated incorporated cities end up with police depts of their own to put more forces in the area as opposed to a county.
Police vs. Sheriff... This one is more varying depending on the area of the US you are talking about, in some places sheriffs are basically court police that handle serving warrants/summons, transport of detainees/prisoners, and to secure the court buildings. While in other areas the sheriff's depts are actually full blown law enforcement officers that will respond to calls and handle most day-to-day police duties.
As a rule an incorporated city police officer won't be doing his duties outside of his city within another county or city's jurisdiction, especially while off-duty. IF in the course of his duties he should be required to cross a jurisdictional line pursuing a suspect, they generally will do so and notify the authority over the area of responsibility. Police officers, just like civilians have the ability to detain suspects while waiting for the police authorities to show up to address the issue, and generally that is what is practiced outside of their jurisdictional responsibility.