https://www.mlb.com/news/guide-to-baseball-s-waiver-trade-system-c140073380
When a player is on waivers, other teams can submit a claim. If more than one team does, those in the same league as that player's team get first priority, starting with the club with the worst record on the day of the claim. Then, the priority moves to the other league, starting with the worst record. For example, if a National League team puts a player on waivers, the NL team with the worst record gets the first shot at him, and the last-place American League club would be right behind the top NL club.