As of the 2018 errata, if an enemy takes damage from your spirit guardians spell, your sanctuary spell ends
The description of the sanctuary spell (PHB, p. 272) originally said:
If the warded creature makes an attack or casts a spell that affects an enemy creature, this spell ends.
The 2018 PHB errata added "deals damage to another creature" to the list of conditions that end the sanctuary spell. The description now reads:
If the warded creature makes an attack, casts a spell that affects an enemy, or deals damage to another creature, this spell ends.
Even though the spirit guardians spell doesn't directly affect an enemy creature when cast, it does deal damage to them:
An affected creature's speed is halved in the area, and when the creature enters the area for the first time on a turn or starts its turn there, it must make a Wisdom saving throw. On a failed save, the creature takes 3d8 radiant damage (if you are good or neutral) or 3d8 necrotic damage (if you are evil). On a successful save, the creature takes half as much damage.
And thus, the sanctuary spell ends as soon as an enemy takes damage from spirit guardians.
Even before the 2018 errata, the intent was that damaging an enemy would end the spell (though this was not reflected in the description of the spell). At the time, 5e rules designer Jeremy Crawford unofficially stated this on Twitter in 2016:
You first cast spirit guardians and then sanctuary. Does sanctuary end when spirit guardians deals damage to enemies?
RAW: Sanctuary isn't stopped if an already-cast spell deals damage. RAI: A damaging activity ends the spell.
RAI means errata or a future edition would possibly change RAW, right? Thanks for the answer
not sure I understand this: by RAW it's possible, but you guys "patched" it with RAI but haven't published an errata about it yet?
We haven't changed the spell.
But you will right? Otherwise the difference between RAW and RAI is lost to me
It works as written, so you can confidently use RAW. If you're the DM and prefer the RAI, change it.
Clearly, the 2018 PHB errata has changed the spell to work as intended.