Seriously, don’t fear it. Not only does it not hurt, but it is good. Cherish the foam. Love the foam. Be the foam.
In all seriousness, I deliberately shake my fermenters/kegs to make as much foam as possible. The foam protects them from whatever nasties may be lurking in the air. Once you rack your beer in, most of the foam gets pushed right out. The small amount of starsan that does actually mix with your beer makes no difference to taste. In fact, I have accidentally spilled a considerable quantity of starsan into my beer before, with no ill effect.