Then why'd she get bumped from Commander in TSFS to Chief Petty Officer in TVH in the service of Starfleet HQ, then back to Lieutenant Commander in TUC when on Excelsior?
Actually, it's only junior Lieutenant in ST6:TUC. The Lieutenant Commander bit comes from Tuvok's feverish dream in "Flashback", and is probably about as much based in reality as the rest of that dream.
But yes, the reddish-haired Commander in ST3 represents a massive discontinuity in Rand's career, and thus probably is best interpreted as GLW playing another character for a change. The actual Janice Rand going mustang after ST4 and reaching Lt (jg) by the time of ST6 is plausible career development...
Also, I'm fairly certain that was Starfleet security holding McCoy, rather than civilian.
The gaol personnel certainly wore Starfleet insignia, as did their leather-armored reinforcements. It's just the plainclothesman who arrests McCoy in the first place that we might interpret as a civilian cop of some sort - he says he represents "Federation Security", which may
be an organization separate from Starfleet.
That would be our only time witnessing law enforcement performed by civilians, though. (It's more like "secret police" business, actually. But if CIA arrested McCoy, would they agree to deliver him to a USAF gaol?)