Most likely that it's a backlog of constipation, with solid rocks sitting in a stretched up rectum, then liquid poo from higher up leaking past as accidents. He probably doesn't need a referral, just to fully treat his constipation.
Go back to the GP. Saw that you are worried that he has faecal impaction (backed up poo) with overflow diarrhoea and that he needs disimpaction. This is using absolute shedloads of movicol to make them poo enough liquid stuff to dissolve the rocks. It takes quite a few days of pooing vast amounts of liquid poo, then lumpy poo, then very liquid poo to achieve this. They usually need to be off school, because accidents will increase. But if you don't do it, the rocks don't shift. Then the rectum is still stretched up, so need to still not stop the movicol/laxido, but carry on at a dose that means going every day, without pain, with soft squidgy poo for months (at least as long as they've been bunged).
Vast majority are perfectly sortable by the GP with movicol. Guidance is only to refer if they don't improve after sticking with doing this.
Many people find eric.org.uk useful. Or, if you prefer personal experience, do a search: there are a lot of threads about this on here, which may be helpful to you.