I want to know if its safer to have sex 2 days after priods end
You'd do better 2 days before your period is due.
Normally you ovulate between days 11-16 (28 day cycle). If your period runs 5-7 days and you have sex on day 9 of your cycle there is an increased chance of pregnancy.
Sperm can live up to 5 days, so that would be day 14 of your cycle.
After you ovulate, the egg is only viable for about 48 hours. Odds are very slim that you'd become pregnant at that point.
There is always a chance.