If this started suddenly then I strongly suggest looking into PANS/PANDAS.

My daughter has a fairly recent dx of OCD (which is not at all what I thought it was, especially how she presents with it). We had no idea this was going on until her most recent ED Psych/IQ assessment. We thought she had "a bit of anxiety sometimes".

After a random moment in a conversation yesterday it occurred to me that these problems set in quite suddenly in early primary school and have come and gone. And I wonder now about PANDAS/PANS. But it is going to be a tough road to figure out if that is what it is she has, when the initial episode was put down to other issues.