Use of Big-O Notation: Size of Input vs Input
You have it backwards, but you are on to an important distinction.

$O(N)$ if $N$ is a number in the input is perfectly well-defined and can appear in, say, the $\Theta$-asymptotic of a runtime function.

In your example, note that $\sqrt{N} = 2^{w/2}$ and thus $O(\sqrt{N}) = O(2^{w/2})$ -- it's just another way of expressing the same function class, given the identity $w = \lg N$.

The distinction between $f(N)$ and $f(\langle N \rangle)$ is only important in the context of complexity classes. Many of those are defined along the lines of


  Class $X$ contains all problems for which there is an algorithm with runtime in $O(f(|x|))$ where $x$ is an input string.


For examples, see pseudo-polynomial problems/algorithms.