Constipated to the max

I switched my son from formula to 2% then had to switch to whole milk. He has been extremely constipated and today he pooped and this came out. I tried to observe and i couldn’t tell if this looked like blood or not. Do I need to take him to the doctor?