DIAGNOSIS This is typically an adaptive sync (FreeSync) handshake or compatibility issue, or a defective DisplayPort cable causing signal instability.
FIX First, disable Adaptive-Sync in the monitor's OSD under Game > FreeSync. Test. If flickering stops, re-enable it. Then, in NVIDIA Control Panel (for G-Sync Compatible mode), set Monitor Technology to 'G-Sync Compatible' and check 'Enable settings for the selected display model'. Ensure V-Sync is set to 'On' in the 3D settings globally.
IF THAT DIDN'T WORK Replace your DisplayPort cable. Use a certified VESA DisplayPort 1.4 cable, under 2 meters in length. The included cable is often insufficient for the monitor's 3440x1440 @ 165Hz bandwidth with adaptive sync active.
HEADS UP The G5's VA panel has slower pixel transition times in dark scenes. This can cause visible overshoot (coronas) or flicker with variable refresh rates. In the OSD, set Response Time to 'Standard' instead of 'Faster' or 'Fastest' to minimize this artifact.