A characterisation of $\mathbb{P}^n$
The hypotheses above are very strong, and they impose strong hypotheses on the cohomology of the complement $U$ of the universal hyperplane section. Using Leray spectral sequences for both projections, this quickly gives the result. Denote the dimension of $X$ by $n$, and denote by $m$ the dimension of the ambient projective space $\mathbb{CP}^m$ in which $X$ is embedded as a linearly nondegenerate variety.
Proposition. Assume that for every hyperplane $L$ in $\mathbb{CP}^m$, the intersection $H=L\cap X$ is a Cartier divisor in $X$ such that the open complement $X\setminus H$ is isomorphic to $\mathbb{C}^n$. Then $n$ equals $m$, and $X$ equals all of $\mathbb{CP}^m$.
Proof. Denote by $\widehat{\mathbb{CP}}^m$ the dual projective space of hyperplanes $L$ in $\mathbb{CP}^m$. Consider the following closed subset $Y$ of $X\times \widehat{\mathbb{CP}}^m$, $$Y :=\{(x,[L])\in X\times \widehat{\mathbb{CP}}^m : x\in L\}.$$ By hypothesis, the open complement $U$ of $Y$ in $X\times \widehat{\mathbb{CP}}^m$ is an affine space bundle over $\widehat{\mathbb{CP}}^m$. By the Leray spectral sequence for cohomology applied to the second projection, $$\text{pr}_2:X\times \widehat{\mathbb{CP}}^m \to \widehat{\mathbb{CP}}^m,$$ the cohomology of $U$ equals the cohomology of $\widehat{\mathbb{CP}}^m$. In particular, the cohomological dimension of $U$ equals $2m$.
On the other hand, we also have the first projection, $$\text{pr}_1:X\times \widehat{\mathbb{CP}}^m \to X.$$ The restriction of $\text{pr}_1$ to $U$ is again an affine space bundle, but now of relative dimension $m$. Thus, the cohomology of $U$ also equals the cohomology of $X$. In particular, the cohomological dimension of $U$ equals $2n$.
Since the cohomological dimension of $U$ equals both $2n$ and $2m$, the dimension $n$ of $X$ equals the dimension $m$ of the ambient projective space $\mathbb{P}^m$. Therefore $X$ equals $\mathbb{P}^m$. QED
However, this is an interesting question, and variants often arise (with weaker hypotheses, of course). So here are some further observations. One of the coarsest topological invariants is the Euler characteristic of cohomology with compact support. For a complex algebraic variety $X$ considered as a set of $\mathbb{C}$-rational points with the classical / Euclidean / analytic topology, for a Zariski closed subset $Z\subseteq X$ with its induced topology, and for the open complement $X\setminus Z$ with its induced topology, there is a long exact sequence of compactly supported cohomology, $$\dots \to H^r_c(X\setminus Z;\mathbb{Z}) \to H^r_c(X;\mathbb{Z}) \to H^r_c(Z;\mathbb{Z}) \xrightarrow{\delta} H^{r+1}_c(X\setminus Z;\mathbb{Z})\to \dots $$ This gives rise to an equality of compactly supported Euler characteristics, $$\chi_c(X) = \chi_c(X\setminus Z) + \chi_c(Z).$$
Thus, for a linearly nondegenerate, irreducible, Zariski closed subset $X$ of $\mathbb{P}^n$ that is smooth, if for every hyperplane section $H$ the open complement $X\setminus H$ has equal Betti numbers, then also the Euler characteristic $\chi_c(H)$ is independent of the choice of hyperplane section.
On the other hand, for a field $k$ of characteristic zero, such as $k=\mathbb{C}$, for an integral closed subscheme $X$ of $\mathbb{P}^n_k$ that is smooth, a general pencil $(H_t)_{t\in \Pi}$ of hyperplane sections $H_t$ will be a Lefschetz pencil. There are many references for this; one reference is Corollary 2.10, p. 46 of the following.
Voisin, Claire, Hodge theory and complex algebraic geometry. II. Transl. from the French by Leila Schneps, Cambridge Studies in Advanced Mathematics. 77. ZBL1032.14002.
In positive characteristic, this can fail, although it is often still true. The standard reference is the second volume of SGA 7.
In characteristic $0$, there will be only finitely many elements $t$ of the pencil, say $t\in\{t_1,\dots,t_\delta\}$, such that $H_t$ is singular, and each singular member $H_t$ will have a single ordinary double point. The finite set $\{t_1,\dots,t_\delta\}$ is the discriminant locus. For each such $t$, the Betti numbers of $H_t$ and of the nearby fibers $H_s$ will differ in precisely one degree, coming from a vanishing cycle, so that the difference of Betti numbers is $\pm 1$ (depending on the parity of the cohomological degree of the vanishing cycle). Thus, $\chi_c(H_t)-\chi_c(H_s)$ equals $+1$ or $-1$ for every $t$ in the discriminant locus. The precise cardinality of the discriminant locus is computed in my answer to a previous MathOverflow question: Bounding the number of critical points in a Lefschetz pencil
If this cardinality is nonzero, then there are hyperplane sections with varying Euler characteristics, and thus there open complements also have varying Euler characteristic. When the cardinality of the discriminant set equals $0$, then $X$ has defective dual variety, sometimes also called "defective discriminant variety", "degenerate dual variety", "degenerate discriminant variety", etc.
Starting with Griffiths-Harris, then Ein, and then many others, varieties with defective dual variety have been classified in low dimensions. One general result proved by Beltrametti-Fania-Sommese is that every such variety admits a Fano fibration (possibly with base equal to a point) whose general fiber is a Fano manifold that also has defective dual variety. However, for a general hyperplane section $H$, since $H$ is irreducible (I am assuming that $\text{dim}(X)\geq 2$ since the result is trivial in dimension one), the exact sequence of Picard groups gives $$\mathbb{Z}\cdot [H] \to \text{Pic}(X) \to \text{Pic}(X\setminus H) \to 0.$$ If $X\setminus H$ is affine space for a general hyperplane section $H$, then $\text{Pic}(X\setminus H)$ is zero. Thus, $\text{Pic}(X)$ equals $\mathbb{Z}\cdot [H]$. If the target of the fibration has positive dimension, then the pullback of an ample divisor class from the target contradicts that $\text{Pic}(X)$ equals $\mathbb{Z}\cdot [H]$. Therefore, if $X$ is a variety with defective dual variety such that $X\setminus H$ is an affine space for a general hyperplane section $H$, then $X$ is a Fano manifold (hence simply connected) with Picard rank $1$.
By a theorem of Fujita and Libgober-Wood, the only fake projective spaces of dimension $\leq 6$ that are simply connected are honest projective spaces. In conclusion, for a smooth projective variety $X$ of dimension $n\leq 6$, if $X$ has dual defective variety and if $X\setminus H$ is isomorphic to affine space for a general hyperplane section $H$ of $X$, then $X$ is isomorphic to projective space, and $H$ is a general linear hyperplane in that projective space.
Here's a quick proof over a finite field $\mathbb F_q$, if we assume that the isomorphisms with $\mathbb A^n$ are defined over $\mathbb F_q$. Suppose $X$ of dimension $n$ embedded in $\mathbb P^N_{\mathbb F_q} $ has this property. Every hyperplane complement in $\mathbb P^N(\mathbb F_q)$ contains $q^N$ points, of which $q^n$ lie in $X(\mathbb F_q)$. So the fraction of points in the hyperplane complement that also lie in $X(\mathbb F_q) $ is $q^{n-N}$. Averaging over all hyperplane complements, as each point in $\mathbb P^{N}(\mathbb F_q)$ is in the same number of hyperplane complements, we see that the fraction of points in $\mathbb P^N(\mathbb F_q)$ that also lie in $X(\mathbb F_q)$ is $q^{n-N}$. Thus $$|X(\mathbb F_q) |= q^{n-N} |\mathbb P^N(\mathbb F_q)| = q^n + q^{n-1} + \dots q^{n-N}$$ which is not an integer unless $N \leq n$, in which case $X = \mathbb P^n$ because it is an $n$-dimensional subscheme of $\mathbb P^N$.
If we replace the assumption by the statement that every hyperplane complement defined over $\mathbb F_q$ has an isomorphism with $\mathbb A^n$ defined over $\overline{\mathbb F}_q$, we can do it with a quick etale cohomology lemma.
Every variety $Y$ over $\mathbb F_q$ with $Y_{\overline{\mathbb F}_q} \cong \mathbb A^n_{\overline{\mathbb F}_q}$ has $Y(\mathbb F_q) = q^n$.
Proof: By the Grothendieck-Lefschetz fixed-point formula and the calculation of the cohomology of affine space we have $$Y(\mathbb F_q) =\sum_{i}(-1)^i \operatorname{tr}(\operatorname{Frob}_q, H^i_c(X, \mathbb Q_{\ell}) = \operatorname{tr} (\operatorname{Frob}_q, H^{2n}_c(\mathbb Q_{\ell})).$$ Furthermore, $H^{2n}_c$ is one-dimensional and the Frobenius eigenvalue on it can be computed by Poincare duality as $q^n$, because the unique Frobenius eigenvalue on $H^0(Y_{\overline{\mathbb F}_q}, \mathbb Q_\ell)$ must be one.
With this enhanced form, we can get the statement over an arbitrary field by a spreading out argument. First, define a stratification of the dual variety, and, over a finite etale covering each stratum, an explicit isomorphism from the family of hyperplane complements to $\mathbb A^n$. To do this, choose an isomorphism at the geometric generic point, which automatically extends to a finite etale cover of an open set, and induct. Next, choose a finitely generated ring over which $X$, the projective embedding, this stratification, the finite etale coverings, and all these isomorphisms are defined. Over an open subset, the stratification will remain a stratification and the isomorphisms will remain isomorphisms. Choosing a finite field-valued point in that subset and performing a counting argument, we see $n=N$ and conclude $X = \mathbb P^n= \mathbb P^N$.