Two taxable events, two heads of income
The first event is exercise, or vesting for an RSU. The difference between the fair market value and what you paid is a perquisite - it is salary income, and it is taxed at your marginal slab rate whether or not you sell a single share. For an RSU there is no exercise price, so the entire fair market value at vest is perquisite.
The second event is sale. The gain is the sale price less the fair market value at exercise, taxed as capital gains. The fair market value is the hinge between the two events: it is the ceiling of the perquisite and the cost basis of the gain. Using the exercise price as the basis instead taxes the same money twice, and it is the most common error in hand-rolled ESOP arithmetic.