In DS9 s6e11 "Waltz", Worf is back on duty as a Starfleet officer. Last I remember, he was serving as first officer of the IKS Rotarran. I guess I wasn't paying attention.
Worf's service aboard the IKS Rotarran is discussed in DS9: Soldiers of the Empire. In short, he's on a temporary assignment.
SISKO: As of this moment you will be relieved of all Starfleet obligations and will be placed on detached service to the Imperial Klingon Defense Forces.
This is a real-world military term that means "serving away from one's assigned unit or company without being formally transferred"
As to why/when he returned, both Martok and Sisko make it abundantly clear that he's being released for the duration of the mission only, not as a semi-permanent assignment. Presumably once the mission was over, he came back to DS9 (along with Dax) by the most expeditious route:
Martok: Worf, son of Mogh... I ask you to join me on this mission as my friend... and as my first officer.
MARTOK: Your tone does not sit well with me, helmsman. Our mission is to find the B'Moth, not satisfy your warrior's pride.
SISKO: I told the General I'm inclined to grant his request for your services, commander. I can certainly understand why he'd want you along -- you're a fine officer. But I'm not sure why you want to go on this mission.