Up to 60,000 children in Scotland are believed to be living with drug-addicted parents.
Health and social workers face having to try to help the often chaotic lives of such families on a daily basis.
But one project in Fife is trying to tackle the issue at a much earlier stage.
The Vulnerable in Pregnancy (VIP) initiative aims to help women turn their backs on drugs before their babies are born.
One mother who has taken part says it has made a difference to her situation.
Claire, which is not her real name, started taking heroin at the age of 20.
But she says she has been clean now for two years with the support of the project.
"I don't think I would be clean, I think I would still be using," she says.
"Only because you know that support is there, they help you to get by."
Using drugs or alcohol during pregnancy can lead to an infant being born too early or underweight and to birth defects.
Babies may also suffer withdrawal symptoms and develop learning or behavioural problems.
Many women who use drugs want to undergo a rapid detoxification when they discover they are pregnant.
However, this is often not practical as it can lead to withdrawal symptoms and distress for the unborn child.
The VIP project, which is run by NHS Fife and Fife Council, aims to stabilise the mother on a methadone programme and encourages her to breastfeed her child.
More than 600 women have been supported by the initiative since it began about a decade ago.
Joyce Leggate of NHS Fife, who started the project, said it had resulted in fewer babies being born to drug-addicted mothers.
She said it worked for the vast majority of women, as many were ready to make changes to their lives.
"They don't want their babies to be born with a heroin addiction or a drug addiction and they are rightly afraid their children could be removed from their care if they don't get themselves sorted out," she said.
"So we are able to capitalise on that motivation."
Social workers are also involved in the project to make sure there are no other risks to babies being born to recovering addicts.
Angela Todd, of Fife Council, says becoming involved in the early stages of a drug addicts' pregnancy has played an important role in keeping families together and safe.
"I would say there has been a decrease in children that have been removed from their parents' care," she said.
"In the past sometimes if we have not intervened early enough then we haven't been able to put the supports in early in pregnancy, which then has resulted in the mother, parents, not being able to make the changes in time for the birth."
For Claire, who is expecting her fourth child in a couple of months, having access to such support has transformed her family's life.
"Everything has just fallen into place," she says.
"I am so much happier, and to see the weans enjoying themselves, it's just so much better."