Slightly expanding the comment of J. C. Otterm, I think $\mathcal O_X(D)$ should not be interpreted as a line bundle but rather as a sheaf of sections.

So, summing up:

When you consider a (holomorphic) line bundle $L\to X$ you should think at that as a complex manifold together with a holomorphic surjective map to $X$, locally trivial, whose fibers are complex vector spaces of dimension one (and the local trivialization are compatible with the vector space structure).

When you consider a (Weil or Cartier: I am assuming $X$ to be smooth so that the two concepts coincide) divisor $D$, you should look at it just as a formal integral combination of codimension one irreducible subvarieties.

When you consider $\mathcal O_X(L)$, you should look at it as the sheaf of holomorphic sections of $L\to X$.

When you consider $\mathcal O_X(D)$, if $D=\sum_j a_j D_j$ where $a_j\in\mathbb Z$ and $D_i$ are prime divisors, you should look at it as the sheaf of meromorphic function on $X$ which have at least zeros of order $a_i$ along $D_i$ if $a_i\le 0$ and at most poles of order $a_k$ along $D_k$ if $a_k\ge 0$.

Of course, these four concepts are strongly related.

For instance, given a divisor $D$ one can form an associated holomorphic line bundle, let's say $L_D$ and then consider its sheaf of holomorphic sections $\mathcal O_X(L_D)$ which is naturally isomorphic to $\mathcal O_X(D)$.

On the other hand, given a holomorphic line bundle $L\to X$ where $X$ is projective, then it always admits a meromorphic section $\sigma$. Let $D_\sigma$ its associated divisor. Then, $L_{D_\sigma}\simeq L$ as holomorphic line bundles.