I'd say Luke's (and user10944's) answer of an octave sounds about right for vocal parts. While typical SATB vocal ranges for your standard 4-part harmony are usually listed as about an octave and a half each, many simple melodies stay within about an octave. Depending on the melodic contour, that octave may stretch from dominant to dominant (as in Amazing Grace) or from tonic to tonic (as in Joy To The World). As you say, there are of course outliers. The Star Spangled Banner is my go-to example of a song with a large range that makes it difficult for some to sing -- it's range is an octave + a fifth.
For instruments, I think the answer is going to be rather larger, and also more variable depending on the instrument and the genre. On the one hand, if you're thinking of instrumental parts doubling the vocal lines in a Bach chorale, you're obviously going to stay rather conservative with your range. On the other hand, if you're writing a flashy concerto, you're going to show off as much of the instrument's extended range as possible.
You may also be interested in the term "tessitura" which sort of describes what you're taking about -- the average, comfortable range used either by a voice or instrument, but ignoring the extreme highs and lows.
In music, tessitura (Italian for "texture") is the most musically
acceptable and comfortable range for a given singer or, less
frequently, musical instrument; the range in which a given type of
voice presents its best-sounding texture or timbre.
The term is also used to refer to where a specific part falls (on average) relative to the voice or instrument playing it.
In musical notation, tessitura is used to refer to the compass in
which a piece of music lies—whether high or low, etc.—for a particular
vocal (or less often instrumental) part. The tessitura of a piece is
not decided by the extremes of its range, but rather by which part of
the range is most used.