You can get mucous coming from your anus when you have haemorrhoids/constipation too, it's your body's way of lubricating the area to make passing poo easier. Given that you're pregnant and constipated it's much more likely to be normal haemorrhoid symptoms than colon cancer
You’ve strained to hard I’d say. This happens to me if I get constipated and some times it causes a pile. I honestly wouldn’t worry unless it happens frequently.