To find the distance from one star to another, we need three things for both of the stars: their right ascensions, declinations, and the distance from Earth to those stars.
So, let's get those things:
From the Wikipedia page on Alpha Centauri:
$RA = 14^h\:39^m\:36.49400^s$
$DEC = -60^{\circ}\:50'\:0.23737''$
$R = 4.37\:\rm{ly}$ (you gave 4.366, some other sources give 4.367... I'm going to stick with 4.37)
and for Barnard's Star:
$RA = 17^h\: 57^m\: 48.49303^s$
$DEC = +04^{\circ}\: 41'\: <PHONE_NUMBER>''$
$R = 5.958 \: \rm{ly}$ (again, you gave a slightly different value, I'm sticking with Wikipedia for now)
where RA is right ascension, DEC is declination, and R is radial distance from Earth to the target star.
Now, by themselves, it is relatively difficult for us to obtain an actual distance. What I would do is convert these to rectangular coordinates, and then it's a matter of using the 3-d distance formula.
First, however, we need to convert RA and DEC into units like radians or degrees.
For right ascension, we can use the general formula:
$degrees = 15 (h + \dfrac{m}{60} + \dfrac{s}{3600})$
and for declination:
$degrees = deg + \dfrac{m}{60} + \dfrac{s}{3600}$
(when the declination is negative, however, multiply all terms in the formula by -1)
So, for Alpha Centauri AB, we have:
$RA = 15 (14 + \dfrac{39}{60} + \dfrac{36.49400}{3600}) \approx 219.902^{\circ}$
$DEC = -1 (60 + \dfrac{50}{60} + \dfrac{0.23737}{3600}) \approx -60.833^{\circ}$
and for Barnard's Star, we have:
$RA = 15 (17 + \dfrac{57}{60} + \dfrac{48.49303}{3600}) \approx 269.452^{\circ}$
$DEC = 04 + \dfrac{41}{60} + \dfrac{<PHONE_NUMBER>}{3600} \approx 4.693^{\circ}$
Now, to convert from spherical to rectangular coordinates, we have to define which of RA, DEC, and R can be assigned to $r$, $\theta$, and $\phi$. 371
R should be $r$ - that's pretty straightforward. Since RA can be thought of as "celestial longitude", we'll assign it to $\theta$, and thus declination will be $\phi$.
To clarify, I'm defining $\phi$ as the angle from the xy-plane - so a $\phi$ of $\dfrac{\pi}{2}$ would mean pointing straight upwards. I know some sources define $\phi$ as the angle complementary to that angle (so, $\dfrac{\pi}{2}$ - the angle from the xy-plane), but for astronomical purposes, I think the definition I'm using is more intuitive and easier to work with.
We can then use the conversions:
$x = r\cos{\theta}\cos{\phi}$
$y = r\sin{\theta}\cos{\phi}$
$z = r\sin{\phi}$
So, for Alpha Centauri AB:
$x = 4.37 \cos{219.902^{\circ}} \cos{−60.833^{\circ}} \approx -1.634\: \rm{ly}$
$y = 4.37 \sin{219.902^{\circ}} \cos{−60.833^{\circ}} \approx -1.366\: \rm{ly}$
$z = 4.37 \sin{−60.833^{\circ}} \approx -3.816\: \rm{ly}$
and for Barnard's Star:
$x = 5.958 \cos{269.452^{\circ}} \cos{4.693^{\circ}} \approx -0.057\: \rm{ly}$
$y = 5.958 \sin{269. 371