First off, if you are worried get an std test today. Life is too short to carry this type of stress and anxiety.
In short, it depends. Grinding with clothes on, no. Sexually transmitted diseases need direct skin-to-skin contact of the affected area in order to be transmitted. Furthermore, if the STD is a virus than the virus within the affected individual would have to be active in order to be contagious.
Let’s examine genital warts (aka HPV) as an example. There are over 25 different strains of HPV. Although pharmaceuticals have created a vaccine it is only covers the most common strains of genital warts. The good news here is that over 90% of genital warts are caused by only 2 strains of genitals warts, and the HPV vaccine covers both these strains. Genital warts is a virus. In order for it to be contagious the carrier must have an active HPV virus in the body at the time of sexual contact. If the virus is inactive, it can not be transmitted effectively. If you recently acquired HPV then more than likely the virus is active in your body. That being said, this does not mean it will remain active your entire life. The switch to make it active or inactive can get switched on or off many times throughout your life. It is directly correlated to your immune system. If you stay healthy the chance of the HPV switch going off and staying off is high. Whereas, if you have an auto-immune disorder then the HPV switch will more than likely turn on and/or stay on. The individuals that I know that acquired genital warts all had an initial outbreak within the first month of acquisition and after the first two years haven’t had another outbreak since (20 years later). That being said, I have one friend that is elderly and near the end of life. His battle with cancer has hurt his immune system and he is having his first outbreak in 60 years.
Herpes (aka HSV) is often very similar. Many people see herpes as a punishment from God that is so shameful that they will never get married out of fear of having to tell their soon-to-be significant other that they carry HPV. I hurt for these people because it is my experience that this is not the case. More often than not, herpes causes an initial outbreak at 2 weeks and then remains dormant the rest of their life. A good friend of mine lost their father to skin cancer and HSV never switched on when his immune system became compromised.
Back to the original question. Clothes on = no way. Skin to skin, but no penetration and we are assuming the other person has an active STD virus? Maybe, the odds have definitely increased. One of the biggest factors is which STD are they carrying and is the infected individual male or female? Females are slightly more susceptible to STDs than men. HIV isn’t transmitted via skin. HIV needs transmission of bodily fluids. That being said, a virus within bodily fluids can (and will) be transmitted through the skin.
Your best bet is to get an STD test after 1-2 weeks post coitus. It will take that long for a virus to multiply to detectible levels in your body. A follow-up needs to be done 6 months and 1 year later. HIV tends to take longer to be detected. If you need a fast, affordable result go to ANY LAB TEST NOW. Their comprehensive STD panel is only $229 and they have a rapid HIV test where results are ready within 15 min. Best of all, you can remain 100% anonymous, just provide a fake name (they don’t ask for ID verification).