I'll link to a wonderful article in TVTropes which covers this as there is a bit of an overlap and depends on what the State, Local, and Sheriff's and Federal. Federal policing is done through various agencies and are an executive department of the Federal Government. They can enforce Federal Laws anywhere U.S. Law has Jurisdiction.
State Police are, as the name says, State police officers and will enforce the States Laws anywhere in the State's jurisdiction. State Police tend to be the best equipped in their jurisdiction as the state can naturally fund the cool toys better and will often include the Crime Lab and other specialized units. They will also be the go to guys to pull you over on an Interstate or major state road. State level policing also is rather new compared to Federal and Local, and only came into being in 1906. For purposes of simplicity, Tribal Police (Police who patrol Native American Reservations) are on a similar level of state police, but they typically act more like local police.
Moving lower, Local is less solidly defined and each local police is bound by local laws jurisdiction. This could be County, City, Municipality, or general community. Included in Local policing is "the Sheriff's Office" but we'll get to that in a second. They may have overlap with State Police in their Jurisdiction. There's no real general size and scale of local Police can range from "Andy Griffith and Barney Fife" to NYPD and LAPD, which are larger and better equipped than some state level police.
In principle State Police can cover local police's Jurisdiction while Federal Police can cover Local and State level's Jurisdiction. In practice, they rarely do. Criminals caught by Local police are tried in state court in that locality (because local government is not soveriegn... state government is). However, the principal of Dual-Sovereignty which means the Federal Government can prosecute you for the same crime that the State prosecutes you if they both think it's a crime. In practice, the Feds will typically just not prosecute if the state does it and there's no federal only crimes. This isn't a law but a policy and there are self-imposed rules as to when it's okay to step in and prosecute.
Now, as mentioned above, Sheriff is kind of a unique local police and it needs to be stressed first, Sheriff almost always denotes a county level police office. All states in the United States except Alaska (which has no county sub-divisions) and Connecticut (which has no county government) have Sheriffs and of those 48, all but Hawaii and Rhode Island are elected offices (With a typical term of 3-6 years depending on state law). Sheriff's offices and scope of power vary from county to county but all Sheriff's are the Civil Law Enforcement division of their county which means they will field the balifs at court and are responsible for enforcing court orders and warrants. Many counties (especially rural ones) make them the criminal law enforcement division of the county as well, and in counties where a decently sized town exists, the Sheriff will likely serve as the more specialized policing division while town police will be more local patrol and small crimes.
Sheriffs also are some-what unique in that they have the ability to "Deputize" civilians as needed and as they see fit, essentially drafting the civilian into the police force. This is often why in Westerns, the law man was always a Sheriff. Back then, the Sheriff was often the top cop in the county and if overwhelmed, would rely on towns folk to augment what staff he had, if any (Those in a career of working for a Sheriff are also called "Deputies" and typically aren't fired after the old Sheriff is voted out.). Being deputized was also something you really couldn't refuse and could get jailed for if you tried to. The whole concept stems from the idea of the general population as a militia and that defense of the community was everyone's responsibility. A large number of deputized civillians for a specific purpose is usually called a posse.
Closely related to the Sheriff is the title of Marshal which comes in two flavors: Federal and Local. The Federal Marshals (U.S. Marshal Service) are one of the oldest Federal police forces and are the Federal Civil Law enforcement division of the government (FBI is the criminal division. Essentially they are the National Sheriff's office. A Marshal is appointed by the President to a Jurisdiction of a State and career employees are called Deputy Marshals. Marshals also have the power to deputize civilians and lower level police agencies (the most recent example was the 2020 deputization of Portland Police to assist in protecting the federal courthouse amid multiple days of rioting).
Local Marshals generally would be police for a single large town and like sheriffs would be elected rather than appointed by city government. They also had the power of deputization and were often associated with western towns, which in the U.S. were traditionally a lot more democratic (in that they had more things put to a vote, not that they voted for a political party) than their eastern country men.
Finally, the "ranger" police force typically denoted a state wide volenteer police force that existed in the western area prior to Organized police forces. Most of these ranger groups tend to be a sort of community watch that assists actual police. In the case of the California Rangers, they were absorbed into the state level police when it was formed. With the famous Texas Rangers, they were a sort of mix between National Guard and State Police force (they did not patrol and were more called to assist local law enforcement when needed. Since they weren't payed well at the time and poorly staffed, it was often the fact that "help" was a lone individual, which they turned into the unofficial motto of "One Riot, One Ranger", making a boast that one was all you really needed. These days rangers are more visible as park rangers, who cover national and state parks and typically are enforcing wilderness laws and regulations and keeping park goers safe. They may double as a fish and wildlife service which regulates hunting and conservation laws.
Forgot Tvtropes article. It's not something I would cite, but they are less dry to read. Watch out for wiki walks: American Law Enforcement