The government has triggered an emergency measure to use police cells to hold prisoners, as jails are close to being full again.