I understand that both manifolds and schemes can be defined by gluing of Euclidean spaces and affine schemes respectively. For example, one may regard a manifold $M$ as a limit of a collection $\{U_i\}_{i\in I}$ of open subsets of $\mathbb{R}^n$, where $n=\dim M$, together with another open subsets $U_{ij}$ of $\mathbb{R}^n$ for each $i\neq j\in I$ and embeddings $\phi^{ij}_i:U_{ij}\to U_i$ and $\phi^{ij}_j:U_{ij}\to U_j$. This way we can glue two manifolds $M$, $N$ along another manifold $L$ of same dimension whenever embedding $L\to M$ and $L\to N$ is given.
I am not very good at algebraic geometry, so I am not sure of details, but I think similar things will be possible for schemes: defining schemes as a limit of affine schemes, and gluing two schemes along embeddings.
However, for me, they look very different. For me, it seems quite easier to patching manifolds up, but gluing schemes is very difficult and 'rigid.' For example, there are uncountably many ways to construct $S^2$ by patching up $\mathbb{R}^2$, but the complex projective line $\mathbb{CP}^1$, which is topologically homeomorphic to $S^2$, can only be constructed by glueing two affine lines $\mathrm{Spec} \mathbb{C}[t]$, $\mathrm{Spec} \mathbb{C}[s]$ along the relation $\mathbb{C}[t]_t\to\mathbb{C}[s]_s, t\mapsto 1/s$.
For another example, one can glue two real lines, each of them identified by open intervals $(0,2)$ and $(1,3)$, to make another real line $(0,3)$, but in the world of algebraic geometry, this looks impossible to me.
This is really strange and confusing to me, since gluing of two manifold is quite easy and straightforward, but the gluing of two schemes looks nearly impossible. Am I misunderstanding something? Or are they really different? Can someone give me a good example of gluing two schemes?