If you've eaten spicy foods then your poop can cause your anus to burn when you're pooping it out since your poop gets lined with particles from the spicy foods.
But if you haven't eaten any spicy foods and your poop is still burning you could have a anal fissure which is a split or tear in the lining of your anus.
Anal Fissures can be caused by hard stools or even diarrhea and usually you don't need any treatment for anal fissure since the anal fissure should heal on it's own within 3 to 4 weeks or sometimes sooner.
If you're still experiencing burning pain when you poop then you should see a doctor to rule out anything more serious.
But usually it's nothing to worry about.