Can I have an STD test while I am on my period?

Short answer: yes

Blood in the swab sample has no effect on your result. It remains reliable.