The term you are referring to is "PID/IV correlation", which is when the game generates a Pokemon and can reliably be reversed into a starting "seed" that, when run forward, produces all the values expected.
For SW/SH raids, the game uses a 64-bit seed to generate the same Pokemon for all raid participants. PID, IVs, nature, gender, height, weight, ability, and level. If the original seed is back-calculated, we run it forwards and check if all the values on the Pokemon match what the correlation gives us.
Besides SW/SH raids, there are other encounter types that have correlations, and others that don't; if the game uses the built in cryptographically secure RNG to generate a specific encounter type, each "random" result is effectively unrelated to the previous or next. Wild Pokemon in S/V use the CSPRNG, so therefore are not correlated. However, this does not mean you can use any values you want -- you still should respect the feasibility of probability, in that something with 6 flawless IVs is immediately suspect as "cheated", due to the chances of randomly encountering this result being 1:32^6, or 1:2-billion.
It's up to the user to know the differences between each encounter type, and to know the rules and probabilities of how individual Pokemon can be acquired. PKHeX is able to tell you details about the encounter type and seeds it detects if you check the verbose legality report, which can be done by holding control when requesting a legality check.