By $H^i(X, D)$ I presume you mean $H^i(X, O_X(D))$, where $O_X(D)$ is the invertible sheaf associated to $D$.
Hirzebruch-Riemann-Roch says that the Euler characteristic of any vector bundle $E$ on a smooth projective variety $X$ is $\int_X ch(E)td(X)$, i.e. $ch(E)td(X)\cap [X]$ where $ch(E)$ is the chern character of $E$ and $td(X)$ is the todd class of $X$. Anyways, it doesn't really matter for the question at hand what the exact formula is, the point is the Euler characteristic can be expressed in terms of the topological data of $E$ and $X$, i.e. the chern classes of $E$ and of $X$. In our case $E=O_X(D)$ so the only possible non-zero chern class is $c_1(E)=D$. Let $n=dim X$.When we expand out $\int_X ch(E)td(X)$ the terms that contribute are of the form $D^i\alpha \cap[X]$ where $\alpha \in A^{n-i}(X)$ (Chow theory, or whatever cohomology theory you are working in) and by the numerically trivial hypothesis, any such term for $i>0$ is zero. And what we are left with is the exact same things we would have when we take $E=O_X$, since $c_1(O_X)=0$.
For $X$ singular, I don't have the answer. I heard that there are versions of Riemann Roch for singular $X$, but I don't know the precise statement and perhaps there is an alternative way, e.g. using resolution of singularities, but I don't know.