To compare, they have the following stats and passives at Level 90 Refinement Rank 1: Here’s a more detailed comparison of the two for a few notable units.
For Kazuha, Jean, Anemo Traveler
Xiphos’ Moonlight is undoubtedly the better weapon for Kazuha, Jean, and Anemo Traveler. This is because they’re all Anemo users that scale off Elemental Mastery and need a bit of Energy Recharge. So they basically gain more from Xiphos’ passive than Iron Sting. Swirl damage – aka these units’ main source of damage – only scales from Elemental Mastery and character level. So although Iron Sting’s extra damage bonus is good, they won’t benefit from it at all. Plus these units also need a bit of Energy Recharge for their bursts. Xiphos’ passive helps reduce their energy requirements.
For Nilou
Iron Sting and Xiphos’ Moonlight are very interchangeable on Nilou. So it’s best to just use whichever one you have or the one with more refinements. This is because Nilou greatly benefits from both of them. She scales well with Elemental Mastery, damage bonus, and Energy Recharge for her burst. Xiphos becomes more valuable the less Energy Recharge you have. Otherwise, Iron String is great when you don’t plan on using her burst often – or if you already have enough Energy Recharge.
For Hyperbloom Kuki
Xiphos’ Moonlight is generally the better weapon for Kuki. It helps her charge her burst faster for more Electro application, and it helps with her teammates’ energy too. Xiphos basically has a lot more utility and Elemental Mastery stats than Iron Sting. However, Iron Sting is still a good free-to-play option for those that don’t have Xiphos.