Helping you with phimosis, frenulum breve, tight foreskin, and other male health issues.
It doesn't really matter.
Stretch regardless and stay committed to consistent stretch sessions. That is what matters.
While flaccid, you have more versatility and room to stretch (like if you're inserting your finger for the Finger-Wedge Stretch) since you have more skin to work with and less penis getting in your way.
If you get an erection during your stretch session, then stretch on through it unless it makes your current stretch impossible or too painful.
For example, depending on the nature of your phimosis, you might not be able to insert the Glansie into your foreskin's opening while erect, or maybe your erection is making your inserted flesh tunnel particularly uncomfortable because of your tightened skin.
If that happens during your erection, then switch over to the Pull-Back Stretch until your erection goes away. The Pull-Back Stretch is generally more effective while erect since your glans swells to a larger width.
But once again, it doesn't really matter.
Furthermore, the reality is that most guys don't have a choice in the matter.
Most guys will not have an easy time staying erect while stretching their foreskin or frenulum. Stretching is not a sexually stimulating activity. If anything, stretching the foreskin creates discomfort since tension is being applied to the phimotic ring. This sort of pain typically subsides any sort of erection, and involuntary erections generally don't last long enough for a full stretch session.
However, if you do somehow have a choice between stretching when erect or flaccid, then consider working the Pull-Back Stretch into your session for the duration of your erection as I said above.
I will note that it's harder to retrieve your foreskin if it gets stuck behind the erect glans, so beware.