Diuretics work by affecting different parts of the kidney's nephron. Thiazide diuretics inhibit sodium reabsorption in the distal tubules, while loop diuretics act on the ascending loop of Henle. Potassium-sparing diuretics, on the other hand, inhibit sodium reabsorption in the distal tubule and collecting duct without causing potassium loss.