The best (quickest, easiest and cheapest) time to do it is in the 3 months before she applies for ILR.
The name in her passport and BRP must always match, so if she changes her name on her passport, she MUST change her name on her BRP within 3 months, or she can be fined £1000 and have her visa curtailed.
But if she does the passport name change within the 3 months before applying for ILR, she can simply apply for ILR in the new name without having to change her current BRP.
[If however, she waited and changed the passport name after applying for ILR, she would have to go through a whole application process to update the BRP (including biometrics with UKVCAS), which costs about £180 and takes about 2 months to be processed.]
UK citizenship can ONLY be issued in the name on her foreign passport, so if she wants to be able to use her new name for citizenship she needs to change her passport first.. and as above, the best time to do this is before applying for ILR, so that both her passport and BRP are issued in the same name.