Matt is called a US Marshal. Kansas became a state in 1861, more than a decade before the series is set. There was only one US district court in Kansas and one marshal assigned to it, plus a number of deputy marshal. All deputies would be based in Hays, the capital, not towns like Dodge. And deputies would enforce federal laws and court orders, and capture federal fugitives. They would not have state or local jurisdiction (like breaking up fights in the Long Branch). At the time of the series Dodge had a town marshal, and a county sheriff with jurisdiction outside the town limits.
The real Dodge City is on green rolling plains in SW Kansas. The setting of the series is clearly in a semi-arid, hilly/mountainous area which is clearly Southern California.
Most of the social, racial and political attitudes expressed by the characters during the series reflect the 1950s thru 1970s airing of the series rather than its 1870s/1880s setting.