A useful criterion for triviality of a line bundle $\mathscr{L}$ on an integral curve $C$ is that the trivial line bundle is the unique line bundle of degree $0$ which admits a global section. This is useful e.g. in relative settings in order to characterize the locus in the base where a line bundle is fiber-wise trivial.
Can something similar be said in higher dimensions? In particular, let $\mathscr{L}$ be a line bundle on an integral variety $X$. If we assume that it admits a global section - so we can think of it as an effective divisor $D \subseteq X$ - can we show that if it is also "degree $0$", then it is trivial?
Here, the first natural generalization of "degree $0$" to higher dimension which comes to mind is the criterion of numerical triviality, but I would also be happy to use homological or algebraic triviality if it turns out that torsion is the issue. (This question came from a discussion about varieties over $\mathbb{C}$, but I would be happy to see a solution or counterexample in any characteristic!).