Getting a bike that fits well is very important. The good news is that bikes are relatively adjustable, so as long as the frame is the correct size you can fine-tune the fit relatively easily. Saddle height is pretty trivial to adjust and the saddle can also be moved slightly forward or backward with relative ease. Adjusting the front end of the bike generally involves replacing the stem, which controls not only how far the handlebars are from the frame but also the height of the handlebars.
Mountain bikes generally come in standard sizes (S, M, L, XL) that correspond to your height and are similar across brands. Most bike manufacturers include size charts that list a height range for each frame size. If it looks like you’re between sizes, it’s probably best to choose the smaller size as it’s easier to make sizing accommodations on a smaller frame.