Will the music continue to play after taking off either earbud of the Xiaomi Buds 5 while playing music and wearing it again?

It depends on different situations whether the music will continue to play or not, after taking off either earbud while playing music and wearing it again.
For your reference, here is the detailed explanation:
With the In-ear detection function turned on, if you take off the earbuds while playing music, the music will pause automatically. If you wear the earbuds again, the music will continue to play automatically (regardless of whether the earbuds are in the case).
During video playback, if you take off any earbud and put it on again, it is controlled by the video software to determine whether the video will continue to play automatically or not. Some video software will not play automatically.