$\newcommand{\k}{\mathfrak k}$
$\newcommand{\a}{\mathfrak a}$
$\newcommand{\g}{\mathfrak g}$
$\newcommand{\p}{\mathfrak p}$
$\newcommand{\n}{\mathfrak n}$
I'm quite sure that several sources prove Iwasawa decomposition for a connected semisimple real Lie group $G$ via a corresponding decomposition of its (real) Lie algebra $\mathfrak g_0$, where one first takes the Cartan decomposition
$$\mathfrak g_0 \simeq \k_0 \oplus \p_0$$
(with $\k_0$ being a maximal compact subalgebra), then chooses a maximal abelian subalgebra (kind of a maximal split torus) $\a_0 \subset \p_0$; the "eigenvalues" of $\a_0$ form a (not necessarily reduced) root system, the "system of restricted roots" $\Sigma$, of which we finally choose a positive part $\Sigma^+$ and define $\n_0$ as the sum of the root spaces for those positive roots, leading to a decomposition
$$\g_0 \simeq \k_0 \oplus \a_0 \oplus \n_0.$$
It's worth pointing out that all three components are subalgebras, in particular that is a vector space decomposition, but it's not a direct decomposition of Lie algebras, as none of those three are (in general) ideals. (Rather, $[\a_0, \n_0] = \n_0$ and in general the best we have is $[\k_0, \a_0] \subseteq \k_0 \oplus \n_0$ (note that we have $[\k_0, \a_0] \subseteq \p_0$ but $\n_0 \not \subseteq \p_0$ in general).)
However, if you are just interested in a vector space basis, of course now you can choose bases for each of the summands, and their union gives you a basis of the Lie algebra.
In the example at hand, $\g_0 = \mathfrak{sl}_2(\mathbb R)$, a standard choice is $\k_0 = \{\pmatrix{0&c\\-c&0}:c \in \mathbb R\}$, $\a_0 = \{\pmatrix{a&0\\0&-a}:a \in \mathbb R\}$, $\n_0 = \{\pmatrix{0&b\\0&0}:b \in \mathbb R\}$, and of course if you choose one non-zero element of each, then together they form a basis.
This generalises first to general $\mathfrak{sl}_n(\mathbb R)$, where $\k_0 =$ skew-symmetric matrices a.k.a. $\mathfrak{so}_n$, $\a_0 =$ diagonal matrices and $\n_0 =$ strictly upper triangular matrices, for which obvious standard choices of bases would be
$\{E_{i,j}-E_{j,i}$ ($j>i$)$\}$ for $\k_0$,
$\{E_{i,i}-E_{i+1,i+1}$ $\}$ for $\a_0$,
$\{E_{i,j}$ ($j>i$) $\}$ for $\n_0$.
Even more generally, if $\g_0$ is any split real semisimple Lie algebra with a chosen Chevalley / Cartan-Weyl basis $(H_\alpha, E_\alpha)_{\alpha \in \text{roots}}$, then I would bet that (signs in $\color{red}{\text{red}}$ might flip depending on chosen normalisation)
$\{E_\gamma \color{red}{\pm} E_{-\gamma} : \gamma \in \text{ positive roots} \}$ is a basis for $\k_0$
$\{H_\alpha : \alpha \in \text{ simple roots} \}$ is a basis for $\a_0$
$\{E_\gamma : \gamma \in \text{ positive roots} \}$ is a basis for $\n_0$.
This all matches your special case where $X_3 = K = n_+ - n_-$, $X_2 = A = h$, $X_1=N = n_+$.
On the other extreme, for compact forms of course we just have $\g_0 = \k_0$. Choosing a Chevalley basis for the complexification $\g := (\g_0)_{\mathbb C}$ one can transform that into a basis of $\g_0 = \k_0$ which is made up of
$\{E_\gamma \color{red}{\pm} E_{-\gamma} : \gamma \in \text{ positive roots} \} \cup \{i(E_\gamma \color{red}{\mp} E_{-\gamma}) : \gamma \in \text{ positive roots} \} \cup \{ i H_\alpha : \alpha \in \text{ simple roots} \}$.
For the forms "in between" split and compact, this seems more complicated. I fumbled with related computations in What changes in the representation theory of real Lie algebras?.