Welcome to HCM.
Tampon use is very safe but pain is might be due to uterine cramp during bleeding.
Otherwise pain sometime occurs if you are using small size tampon and there is heavy bleeding inside,so use proper size of tampon according to pattern of your bleeding.Also change it within proper time.
You can take nsaid
with dicyclomin to subside pain during cycle.
Consult your gynecologist for better guidance and local examination.