It's been explained a number of times through the series on how the command structure works and my previous explanations are based on what was said, as well as what was done through various episodes.
DS9 was a jointly operated station with a Starfleet commander in command, but owned by Bajor and under Bajoran jurisdiction. The best way to integrate the Bajorans into being qualified in joining in with the Federation was to get both Starfleet and Bajoran officers to work side by side and equally.
In the same sense, the same procedures were used on the Defiant from time to time, where Kira would be in command or 1st officer or Worf would be.... it tied in with the joint-operations aspect between the Federation and Bajor, which is also why Bajorans were allowed to use the Runabouts and be in command of Starfleet Security officers, etc.
Sure none of this was directly explained within the mentioned episodes above where Kira took command, but considering it was explained a number of times in past episodes over similar situations, why do they need to take out more time in the episodes to re-explain it all again, when it should just be a given?
The only time I remember seeing Kira take command or be first officer on the Defiant was when either Worf wasn't around, the mission they were on had Bajoran interests involved.... or the Defiant was assigned to a large battle involving a large number of ships where having both Worf and Kira's expertise would come in hand..... in the end, it was Sisko's discretion on how it all worked, as there were times Kira was on the Defiant but not as first officer, rather, she was assigned to another station on the left side of the Bridge near O'Brien to keep an eye on sensors, or something.
Well, as the above convoluted explanation underlines, the hierarchy on the Defiant is simply not clear. There are inconsistencies that we can account for by making stuff up: that is the essence of fanwank.
We know it was not initially clear because we can read online reviews that were written when season 4 was first airing and that are full of complaints about this very issue (see Jammer and Michele Erika Green for some examples). In one episode (Rules of Engagement, I think), it seems like
Miles has command priority over Kira on the Defiant, which is never shown to be the case elsewhere. Attentive viewers such as Green and Jammer cannot even tell why
Worf has command priority over Kira on the Defiant, since his position was established as "Strategic Operations Officer" of DS9 in Way of the Warrior (not first officer of anything).
The bit of dialogue in Apocalypse Rising about Worf being in command of the Defiant in Sisko's absence, and Kira in command of the station, was probably meant to clarify this for the benefit of understandably confused viewers (though it raises other problems).
This status quo is then contradicted in Tears of the Prophets because Worf is on the bridge, but Kira takes command. Sisko has had a vision and is incapacited, so there is no indication that he chooses Kira for some specific reason at that moment.
Here we have to fanwank an explanation, the main possibilities being Worf's losing command priority after Change of Heart and the fact that he was assigned to be Martok's first officer during the occupation arc (so perhaps his position has been changed to SOO of the station and first officer of Martok's ship, rather than first officer of the Defiant). As is usually the case in this type of scenario, the real reason is out-of-universe: initially, the writers were working the "Worf learns how to be a command officer" angle, while later they had abandoned that in favor of the "Worf becomes a full-time Klingon" angle, so it was no longer meaningful to have Worf in command of the Defiant.