The only risks for HIV in adults are:
1) Having unprotected (no condom) penetrative anal or vaginal sex, OR
2) Sharing IV drug equipment with other IV drug users.
No other event that you can think of, including the event you mentioned, puts you at risk for HIV. As long as the head of your penis was covered DURING intercourse, you did not have a risk for HIV. You do not need to test for HIV.
I can't help you with your negative thinking, but if it is interfering with your life, you may want to seek counseling.