Call of Duty: Warzone 2 players discovered an XP exploit that lets them max out weapon levels almost instantly, but only until the game's developers inevitably patch out the trick. It involves a desired, weapon, lots of money, and lots of running around the map, so while it's not always easy to pull off, it looks to be able to put players in a prime position regarding their weapon levels.
The trick's been shared several times over by now, but it starts by finding a weapon that you want to level up. That's sometimes easier said than done in Warzone 2, but it's what you have to do first unless you want to just level a random weapon, so get your hands on something good that you care about.
Next, start raking in as much money as possible as quickly as you can. Nothing too time-intensive, however, because your time is needed elsewhere to make this work, but grab cash where you can find it (you were probably doing that anyway).
While doing that, be on the lookout for the Safecracker Contracts scattered about the map. For whatever reason, these Contracts appear to be working on an XP multiplier right now meaning that you get extra XP for doing the second Contract, more for the third, and so on. Since Warzone 2 awards players weapon XP for completing tasks like this, you'll earn bonus XP for completing multiple Safecracker Contracts. It's unclear if this multiplier is a bug or not, but if it is, it'll probably be the first thing to go once this exploit is addressed.
If you still need more XP after all that, some of the tutorials like the one above from IceManIsaac recommend taking all of the cash you earned and head straight to a Buy Station to purchase some Armor Plates. Those are the cheapest thing you can get from the Buy Station, and buying things for some reason also awards you weapon XP, so more buys means more XP. By the time you've done all of that, you'll likely have maxed out a weapon's XP level already, or if not, you've likely gotten very close.