That will work, but its not designed for serious off road use, but fine for general use - check you cables and wires have enough slack in them to accommodate the increase in height
From the photo, it looks like you have a headset spacer above the stem, these are normally 5 or 10mm thick, if so, undo the central hex bolt usually 4 or 5mm Allen key, then loosen the pinch bolts on the stem, again normally 4 or 5mm, take the top spacer of the steerer tube, lift off the stem with bars still attached, put the spacer under the stem, replace stem and top cap, tighten bolts.
Couldn't be sure from the photo, a high rise stem it is then...Not sure there is a spacer there? It looks like the topcap is directly on the stem
To the OP - the stem must be 100% on the the steerer tube. Follow @Darren's advice regarding riser bars.
The World's largest electric mountain bike community.