Meet Bob, Bob Arctor is the head of a drug ring. Meet Fred, a narcotics detective for the city of Anaheim. They are the same man.
The choice of roto animation is not just for fun's sake by Richard Linklater, it is used as a metaphor for what you are watching. It looks like real-life, but there is a thin separation from reality that hazes your judgement. That haze is reflected in Bob/Fred whose own dependence on Substance D is causing a rift in his mind.
Mental illness is depicted through Barris (Robert Downey Jr.) and Luckman (Woody Harrelson), Arctor's two main flackies with varying levels of psychosis. The two spend a majority of their days discussing alternative theories as to who is really responsible for their troubles. Most of these theories often lead back to the government. Ironically enough the government in charge of the rehabilitation clinic is the hub for the designer drug that is destroying the minds of citizens.
Drug culture has been more widely accepted in this day and age (see the effect of The Big Lebowski and weed culture in general) but what A Scanner Darkly presents is far more serious than a look at drug addicts and the minutiae of their lives. A society that justifies killing for a larger purpose faces greater concerns than drug problems. Mainly, how to look themselves in the mirror.