Did your penises grind together? That could be a potential risk for syphilis, herpes, and HPV, but it takes some significant grinding/rubbing and friction to transmit.
STDs are transmitted by unprotected oral, vaginal or anal sex, or direct, unclothed skin to skin contact of the mouth to genitals, genitals to genitals, and genitals to anus. This requires fairly significant rubbing/grinding and friction, almost always the kind associated with intercourse.
If someone has a sore or rash, you can get it from this direct skin to skin contact, though symptoms don't always need to be present to transmit.
If none of those things happen(ed), you aren't at risk for an STD, including HIV.
You seem to be partnering with men outside your marriage, which is your business, and no judgement here, and then panicking. My only concern is your health and mental health, and making sure you're informed. :)