There is no risk here. STDs are not transmitted that way.
STDs are transmitted by unprotected oral, vaginal or anal sex. Sometimes, direct skin to skin contact of the mouth, genitals or anus can transmit it - mouth to mouth, mouth to genitals, genitals to genitals and genitals to anus - can transmit things, like herpes, syphilis and HPV. Think heavy grinding or rubbing, while unclothed.
This isn't the first time you've done something and been extremely anxious after. I asked you last time if you were getting treatment for your anxiety, and you said no. Maybe now it's time. You do this, become extremely anxious, and yet you do it again. I'm not judging you, but it would be a good idea to find out why you continue to do something that brings you pain.
Hi, you had zero risk to contracting any std from what you describe.
dave