I will (slightly) disagree with Markol's answer here. CP is a computed term based on the IVs (Attack, Defense, and Stamina). It attempts to show how strong a Pokémon is based on those IVs, but it is biased towards Attack. (See PokeAssistant's page on CP for the formula details.)
(Attack)*(Sqrt(Defense))*(Sqrt(Stamina))*(Level Multiplier)^2 / 10
In some cases, overweighting Attack is appropriate - particularly in PVE where you don't care nearly as much how quickly your Pokémon takes damage, you're really in a rush against time to deal damage.
However, in PvP, Attack and Defense are both valuable (equally so, for the most part), as well as Stamina. As such, CP doesn't perfectly reflect the usefulness of a Pokémon. In PvP, two identical Pokémon CP-wise but not IV wise, the higher IV one may be worse, or may be better, depending on the details of the difference. Two that are the same level but one is higher ATK and one is higher DEF, for example, the higher DEF one is likely better overall for PvP but the higher ATK one is possibly better in PvE (or identical).
Additionally, in PvP the ATK value will determine tiebreakers (currently) for charge move priority - a higher ATK Pokémon will go first, in a mirror match, if both fire off their charge move on the same turn. (In a non-mirror match, it's unlikely the base stats would be sufficiently similar for IVs to matter.)
All that aside, two points:
- For the most point, CP is fine, and just use the best CP you can. In Great or Ultra league, you may lose some very close matches on the margins, but much more important are choosing Pokémon, specific moves, and powering them up to the cap.
- You don't have to figure out which is better - there are lots of sites that can tell you what the best IV set is for a particular Pokémon in a particular league. Just search PVP Rankings Pokémon Go, and you'll have numerous results that give you good advice (not all identical - some of this is more subjective, or at least subject to model differences, but most are useful enough.)