If stools are severely impacted - ie not gone to the toilet for 2 weeks, then it is a doctor matter.
There are 2 kinds of ways constipation easing meds help
One is to soften the stool, which includes lactulose, fybergel, Laxido, and one used a lot now, movicol (as well as lots of prunes and fibre), lots of water is key too. (maybe others)
Its individual preferences here but its worth noting that, for example the standard drug given to people who are having a colonoscopy (bowel examination) locally is 8 x doses of movicol to clean you out and lots of water.
The second is the "urge to go a stimulant, and dulcolax comes into that category. (there may be others)
Please dont take these as for sure medical advice, its the extent of my knowledge.