> You generally can’t apply functions to dimensional units. The only thing units can do is be multiplied or divided together. So I can multiply a mass by a distance or divide a distance by a speed, and I can multiply the result by a scalar; but I can’t take the sine of a distance or the logarithm of a time or exponentiate a mass. Those are things I can only do to scalars.
I mostly agree with your explanation, but would like to emphasize that this is just a convention from mathematics which mostly carries over into physics and engineering. We like to define functions that are R -> R and similar, instead of defining special sets like R° = { r * 360° | r \in R }, corresponding to "real numbers with unit degrees", and then defining functions like sin: R° -> R. It’s just simpler to define and analyze most functions from R -> R and so we mostly do that.
But if you look up physics papers, it’s not uncommon to define functions that require unitful inputs as well. For example, the wave function in the Schrödinger equation maps a position r (3D vector with unit meter) and time t (scalar with unit seconds), to a probability amplitude (complex number with unit m^-3/2), so that \int |ψ(r,t)|^2 d3r becomes a scalar (a probability). Up wave function is still considered a function by all physicists.