Step 1: open the Settings and navigate to System > Multitasking.
Step 2: Under the Snap section, change the following option:
Arrange windows automatically by dragging them to sides or corners of the screen.
This should stop the annoying occurance, particularly if you are a power user such as a software developer.