How FSRS deals with rating a card after or before is due?

It’s not done automatically.

You can use the FSRS Helper add-on to do this if you want the cards to immediately be set to that new scheduling. Select the cards you moved in Browse and run Cards > FSRS: Update memory state and reschedule. That will update the DSR components of the memory state, compute a new interval, and set a new due date for the cards.