First of all, you should go to a doctor to confirm your diagnosis. It can either be piles, fissure or fistula. All three of them are completely different conditions. Further treatment will proceed accordingly.
Next Steps
Whatever your actual condition is, avoid getting constipated. For this eat fresh fruits and vegetables daily, stay hydrated, do some physical exercise daily and for reducing the pain do sitz baths twice a day for 20-30 minutes.
Health Tips
You can try homoeopathic medicines for your condition as it gives good results with no side effects.