Thank you for your query.
If your periods have been irregular for the first time and you have been having unprotected intercourse then you at risk of both pregnancy and infection both of which can be associated with unscheduled bleeding. The only way to check for a pregnancy is to do a urine
pregnancy test at home or see a gynaecologist with an early morning urine sample. They will be able to check for an infection as well.
Sometimes irregular bleeding can be the consequence of hormonal imbalance caused by taking hormonal medication, stress, sudden weight gain or loss etc but because pregnancy and infection often need to be dealt with without delay those are the things to get checked out first. The other causes do not require immediate action and can be managed later even if they coexist with pregnancy or infection.
I hope this answers your query.
best wishes