Yes, and this can be proved in the same way, e.g. by the large sieve or the Selberg sieve. Of course, the constant $C$ will depend on $D$.

For a lower bound (for $D=248$ at the moment), see my response to this question.

**Added 1.** As GuestPoster pointed out to me, the upper bound $Z(x)\ll x/\log^2 x$ for the number of twin primes up to $x$ was already established by Brun. His original paper is available here. In fact Brun shows $Z(x)<100x/\log^2 x$ for $x>x_0$, see the last display (37) in the paper. No doubt Brun's method works equally well for the original question above, with $100$ being replaced by an effective constant depending on $D$.

**Added 2.** J. R. Chen proved in his paper "On Goldbach's problem and the sieve methods" (Sci. Sinica Ser. A 21 (1978), 701-738.) that the number of solutions of $P-P'=h$ in primes $P'<P<x$ is less than
$$ 7.8342\times \prod_{p>2}\left(1-\frac{1}{(p-1)^2}\right)\prod_{\substack{p>2\\p\mid h}}\left(1+\frac{1}{p-2}\right)\times\frac{x}{\log^2 x},$$
assuming $x$ is sufficiently large in terms of $k$.
I learned this from a paper of Pintz and Ruzsa (Acta Arith. 109 (2003), 169-194.).