He (had delivered) a prisoner to the county jail when he saw a car ahead of him weave across the yellow line .
Past Perfect is the correct answer because when we use Past Perfect Continuous, it must have a duration.
We cannot use Past Perfect Continuous in the example sentence because here a prisoner is being delivered once, not continuously. We use the past perfect continuous to show that something started in the past and continued up until another time in the past. FOR EXAMPLE : "For five minutes" and "for two weeks" are both durations which can be used with the past perfect continuous.
Some Examples: (1)They had been talking for over an hour before Tony arrived. (2) She had been working at that company for three years when it went out of business.
Here's a link for Past Perfect Continuous : https://www.englishpage.com/verbpage/pastperfectcontinuous.html
"He had delivered" means that the prisoner had arrived at the prison, the delivering of the prisoner had been completed, whereas "he had been delivering" would mean the he had been in the process of delivering for a period of time when he saw the car. For example:
He had been delivering packages for an hour when he saw a car…
The delivering started an hour before he saw the car. The past perfect focuses on the completion, whereas the past perfect continuous focuses on duration or process.