In PGA Tour, professional golf and high-level amateur golf tournaments, golfers are required to adhere to a competition of competition known colloquially as the One Ball Rule.
The One Ball Rule isn't part of the Rules of Golf, meaning not every golfer has to adhere to it either when playing casually or even in most tournaments. However, it's a recognized condition of competition tournament organizers can require of their competitors. The One Ball Rule means basically what it implies, requiring a golfer must use the same golf ball -- same manufacturer and model -- throughout a stipulated tournament round.
For example, if a golfer starts their round with a TaylorMade TP5x golf ball, they have to use that ball throughout the round. They can switch out golf balls as desired between holes or as required when balls are damaged or lost, but the golfer has to change one TaylorMade TP5x for another TaylorMade TP5x golf ball.
The One Ball Rule not only requires a golfer to use the same manufacturer and model of golf ball, but it also compels a player to use a golf ball with the same color throughout a round. That means a golfer can't switch between white, yellow, pink, etc., during a round in the event it would prove advantageous because of a change in conditions.
If a golfer violates the One Ball Rule, they can be penalized in a variety of ways by the tournament organizer. However, the USGA recommends a two-stroke penalty for each hole on which the rule is violated, with a maximum of four penalty strokes. In match play, the USGA recommends a loss of each hole on which the rule is violated, with a maximum of two holes lost.