Can I get pregnant 5 days after my periods and have a 31 cycle?

Ovulation. Yes, of course. As longs as ovulation occurs normally in your cycle. The bigger issue which you failed to include is the day you ovulate in your cycle. All fertility questions depend on that fact. Sperm left in the vagina on the five days prior to ovulation are the most likely to cause pregnancy.