I would go to vet - have you checked anal glands those are on the side of anus and sometimes they get impacted but i would check with vet as usually they rub the floor with butt with that but sometimes bite at backend.
sorry your baby is not feeling well