The Heaviside step function is used to describe charge density when there is a step change, such as a transition from zero charge density to a constant value at a certain point. For example, a charge density of p coulombs per unit volume for x >= 0 can be represented as p * H(x). In contrast, the Dirac delta function is applied for point, line, or plane charges, such as a plane charge density represented as p * delta(x) or a point charge as q * delta(x) * delta(y) * delta(z). The choice between these functions depends on whether the charge distribution is continuous or discrete. Understanding when to use each function is crucial for accurately modeling charge densities in physics.