Dashes are primarily used in informal writing, like letters or notes; they can substitute almost any punctuation, including commas, semicolons, colons, quotes, parenthesis, or stops. They usually designate a pause a little longer than a full stop. Most style guides advise to avoid dashes in formal text, as they make it look immature and not thought-through. Dashes are also used to mark ranges or a missing piece of text -- especially in continuations, quotes, affixes and onomatopoeia.
The hyphens, on the other hand, are a part of the word -- they are used when a word consists of two parts connected too loosely to write them together, but too close to write them separately. They are also used for "hyphenating" a word: breaking it at the right margin when there is not enough space to fit it whole.
In the tradition of European (and others) print there are several "horizontal line" characters used: each of them has different looks, meaning and purpose. Not all of them are used to this day, but the most common ones: minus sign (−), hyphen (‐), figure dash (‒), en-dash (–) and em-dash (—).
When the typewriters were introduced, the technical limitations made every character on their keyboard scarce: thus the minus sign was butchered: made a little longer and lowered, to serve as a replacement for all the "horizontal line" characters. The new character was named "dash" or "minus/dash". Its exact meaning can be usually guessed from the context, but in cases where it mattered, various tricks were used to distinguish its various uses. When computers were created, they commonly used teletype terminals -- and later more advanced teletype terminal emulators -- that all inherited the butchered typewriter character. With appearance of the desktop computers (Apple) and come back of proportional-width fonts, also the various "horizontal line" characters returned. Unfortunately, there is no standard easy way of typing them on the used-to-be-teletype keyboard, and most users are not even aware of them. See Hyphen-minus on Wikipedia.
The number of characters that these glyphs take depends on the encoding used -- they are always single glyphs though. Following the RFC-es for URLs, none of these characters are allowed in URL's unquoted -- instead the "dash/minus" glyph is commonly used.
The tricks used by the typists to distinguish hyphens from dashes include putting a space on both sides of the hyphen/minus character, using two or three hyphen/minus characters in a row (additionally distinguishing en-dash from em-dash), using tilde for separating ranges, etc. Modern typesetting software often adopts these techniques in order to ease the typing of these characters using standard keyboards. This, connected with the greater width of the dashes, can make some people believe that "dash" is a "double character" in some way. An interesting weirdness -- double hyphen -- but this is different.