Help!!

Are stool softeners safe during pregnancy?? Sorry if this is TMI, I’m not constipated, but my bowel movements are extremely hard and solid so it hurts super badly coming out!! Want to know if I can take stool softeners! 22 weeks and 2 days pregnant currently! Thanks in advance