Actually, now that I think about it. A police officer works for a police department. That usually means city enforcement. Police chief is appointed by elected city officials.
A deputy sheriff works for the Sheriff's department, that means county. A Sheriff is elected by the people.
So if it is a police officer, you address them as officer. If it is a deputy sheriff, you address them as deputy.
Ranks are similar in both departments.
The term Agent is used at the national level for departments such as the FBI, CIA, DEA.
Special Agent means they have the authority to arrest subjects.
None of the national departments have the authority to over ride, or take over, local enforcement.