There is no correct order. The correct order is personal.
Showering beforehand makes the beard hairs softer. This ensures easier shaving and fewer razor burns.
Warm shower water removes dead skin cells and degreases the skin. This can cause razor burn during or after shaving.
In case of dry skin, it may be better to shave first and shower after shaving. First shave and then shower, the warm shower water soothes the skin after shaving.