Video for reference: https://youtu.be/ePF-9RtYJDk
Seen a few people mis-understanding how the Tyranid Warrior sniper with the Venom Cannon works so I figured I'd make a quick guide. I've linked a video above to showcase what I'm talking about. Most of this should also be applicable to the Chaos Cultist snipers as well.
TL;DR: wait until laser line goes solid, then dodge away from the line.
The first shot in the video demonstrates what happens when you don't dodge or take any other action. The sniper will usually start by aiming at a point away from the player it's targeting before tracking over to the player. The player will get an audio cue that cuts out just before the sniper shoots. The other cue is a visual cue and is usually the more important one; when the laser line goes solid. Once the laser line goes solid, the sniper is ready to shoot will shoot after a delay of about 2 seconds. this delay can be shorter based on enemy enrage, latency issues, or if the enemy is forced to suddenly switch targets. Certain actions can also trigger an early shot.
The second shot demonstrates a basic dodge. When the laser line goes solid, dodging will trigger the shot. The shot will usually fly off to the side at closer ranges but be aware that at longer ranges, the sniper can shoot at your exact position and due to projectile travel time can still hit you after the dodge I-frames. Due to this, it's not recommended to dodge along the line of the sniper shot or across it. Instead, dodge away from the laser line.
The third shot demonstrates that the sniper does not necessarily need to have the line locked onto you for the line to go solid and the sniper to be ready to shoot so don't assume that just because the laser isn't locked onto you that you are safe.
The fourth shot demonstrates something that often trips people up and that's dodging too early. If you dodge before the line goes solid, the sniper will require one more dodge or a delayed second dodge to trigger the shot (or the regular 2 second delay, whichever comes sooner). This is meant to punish players for jumping the gun. If you dodge too early, you will need to dodge another two times or dodge once more after a short delay to trigger the shot.
The final thing to be aware of is enraged snipers. They not only hit harder, but will often shoot twice in a row requiring two dodges back-to-back. Might catch you off-guard at first if you're not used to it, but if you know what to look for, dodging them is just a matter of timing.