get by without doing~
This pattern expresses relief that something unpleasant was avoided or not done.
You use ずに済む when you end up not having to do something, and that is a good thing. The nuance is relief: 'I got away without doing X' or 'It turned out I didn't need to do X.' The subject is usually the speaker or someone they are happy for, and the situation is something that could have been required but was avoided.
This is a written and slightly formal pattern, but it is also used in spoken Japanese in set phrases like 謝らずに済んだ. The verb before ずに済む is always in the negative, and the whole phrase conjugates like 済む (a godan verb), so you can have past tense 済んだ or potential 済みそう, but you rarely need those forms at N2.
In conversation, you might prefer なくて済む (which has the same meaning) or ないで済む, but ずに済む is fine in both speech and writing. Just be aware it sounds a bit stiff if you use it too much in casual chat.