It's something that's frequently requested. However, it is impossible to do with precision, because the information is not available to the user interface. Blizzard has deliberately chosen to restrict certain types of data in the client that can be used to enable botting, and one of those is position and range data for objects in the world.

The best that can be done (and what many addons do) is test for range brackets based on the known ranges of abilities and actions. You can't tell if target X is exactly 30 yards from you, but you can tell that a spell or ability with a 30 yard range is in range to that target. If it's out of range of a 20 yard ability, you know it's somewhere in the 21-30 bracket. Similarly, if a target is out of range of a 30 yard ability, but in range of a 36 yard ability, you know it's in the 31-36 bracket.

There's also a WoW API function called CheckInteractDistance(), which tells you which specific actions (such as trading, inspecting, etc.) a given unit is in range for. This is how mods like DBM can put up a box telling you who's too close to you for certain fights.

But it is impossible to put up a numeric display (Target is 31.2 yards away), just like it's impossible to put up an off-screen direction arrow or any other display that requires precise knowledge of an object's position in the 3D world.

FYI, this is probably a more appropriate topic for the Mods & Macros forum.