SYDNEY, Australia — When Alyson Colquitt was arrested in 2015 for selling cocaine, she expected jail time. What she did not expect was to spend more than a year in custody waiting to be sentenced, without access to drug rehabilitation or other services.

Ms. Colquitt pleaded guilty to selling less than a gram of cocaine to an undercover police officer. Despite being a first-time offender selling to support her own drug addiction, she was held in custody for 14 months.

“There were absolutely zero opportunities for rehabilitation for prisoners awaiting sentencing in that prison,” said Ms. Colquitt, who ended up overcoming her addiction with no medical support. “I was hallucinating, vomiting, shaking, having nightmares. It was horrible.”

The government of New South Wales, Australia’s most populous state, is not short of money: This year’s budget surplus runs into the billions. But despite its wealth and official promises to “deliver an effective and efficient justice system,” the state’s prisons and courts are overwhelmed with backlogs and sentencing delays that can drift to more than a year for nonviolent crimes, often cutting off access to programs that help keep criminals from offending again.