First of all it's important to know how to prevent the cube from going out of sync with the app: when using the app, keep the cube and the phone in the same place as much as possible.
If your cube isn't in the same orientation as the in the app, or it drifts, you can re-calibrate it by tapping on the icon on the top right of the screen, as shown on this video:
In the rare case that you need to re-calibrate the cube frequently, your cube may need a quick re-calibration of the gyro (IMU) sensor inside of it.
Here's how you do it:
1. Click the "Hamburger menu" (your profile image), and go to "Load Cube State".
2. Click "Advanced" (located in the top-right corner of the screen), and choose "Reset IMU".
3. Follow the instructions on the "Reset IMU" screen:
Place your cube on a flat surface, with the orange center facing up.
Make sure the cube is static (not moving), and click "Reset IMU".
*Note: it is normal (and expected) to have slow orientation drifts.