It is preferable to perform a
hefsek taharah before lighting Shabbat candles. However, even if you only remembered to perform the
hefsek after candle lighting, it is valid as long as it was performed before sunset.
Please feel free to get back to us with any further questions.