I once warned a playing partner not to do this when he picked up a ball which wasn’t (but might have been) his during a search, only for him to pick up his own ball to identify it 30 seconds later!
The rule changed in 2019 – previously you had to tell your opponent or fellow competitor of your intention and give them the chance to witness it. Now you only need to mark the ball before you lift it and replace the same ball exactly where it was before. Rotating the ball in place also counts as lifting it. As a good habit, always mark your ball before touching it – there are examples when you don’t have to, but just mark it anyway.
Also – you can only clean your ball enough to identify it under this rule and can only lift it if it is reasonably necessary to do so to identify it. If you don’t mark it first, over-clean it, or lift it unnecessarily you will get a one stroke penalty. If you don’t put it back on the same spot and then play it this becomes a two stroke penalty for playing from the wrong place.