The cassette is the set of sprockets on the rear wheel; the freehub is the mechanism that carries it. Inside the freehub, a ratchet allows the wheel to turn while the rider coasts and engages the drive when pedalling resumes. Replacing the sprockets alone therefore cannot repair a fault inside the freehub.
A freehub problem may show up as sticking, unusual noise or drive that fails to engage reliably. Other components can create similar symptoms, so the cause needs checking first. The freehub body on many hubs can be removed for service, but construction and lubrication requirements vary by manufacturer.
Some mechanisms call for liquid lubricant, while others specify grease for particular ratchet parts. If cleaning and the correct lubrication do not stop slipping or rough operation, the freehub unit may need replacement. Identify the exact hub model and its service requirements before ordering parts.