I can imagine examples where showing 3 to 5 distinct values in a histogram is perfectly reasonable. The fact that the histogram may well just show a few distinct spikes is not an objection in principle. (You don't have to show only a few bins just because of advice linking binning to sample size.) Easy examples arise with tossing coins, dealing cards, etc. Showing the variability characteristic of very small samples is a lesson even experienced scientists may need to absorb.
I can't think that there is any upper limit whatsoever that makes any sense either.
Millions or billions of observations and say hundreds of bins: I am fine with that. It's routine in several branches of physics, including astronomy.
A concrete example: age at death in a large population. In a large country there are millions of deaths per year and a histogram by age in years is of use and interest. For deaths of children, especially under 1 year old, finer binning would make sense.
I think this question blurs into another you're not asking. For very small and very large samples sometimes other kinds of plots may possibly appeal more or work as well or better in practice. For 3 or 5 values if a plot was worth drawing at all I might make it a dot or strip plot. For very many values, and indeed quite generally, I often use quantile plots, but there is much scope for choices to be made according to personal taste; tradition in a field; who the audience is (have they seen this kind of graph before?); and what works well for the data and problem concerned.
Note: The question starts "A histogram is an accurate representation of the distribution of numerical data." Not by definition, as poor choice of bin width and/or bin origin would easily obscure the structure in a distribution. Also, histograms can be very unsuitable for highly skewed and/or long-tailed distributions, as then bin width can be very hard to optimise.