As an art instructor, one of my main tasks is troubleshooting. Most of my time in classes is spent helping my students evaluate why a particular part of their drawing doesn't look right. And it's amazing how often optical illusions are involved.
Optical illusions are just your brain misinterpreting what it's seeing. Whether you're an artist or not, your brain is unconsciously filling in the gaps in what you see, comparing and contrasting shapes, value, and color. While this serves the purpose of freeing up brainpower for more important things, it can get in the way of accurately drawing or painting what you see.
There are a few different techniques I teach my drawing students to overcome these optical obstacles and which I frequently use myself.
Value is just the lightness or darkness of something, and it applies to grayscale and color. To check value when drawing from a grayscale reference, there's an easy, low-tech solution. Use a hole punch to put a single hole in an index card. Put the hole over the value you're trying to reproduce. Your brain will now be comparing the value to the baseline white of the index card. Values are usually much darker than you realize.
There are a couple of ways to evaluate value in color art. The high-tech way is to take cellphone pictures of your reference image and your art. Desaturate or use a black-and-white filter on both pictures and compare them. Deleting the color information will make any discrepancies in value much easier for your brain to see.
The second, more low-tech way to see color value problems is to use a red or green filter. This can be a piece of colored plastic or glass. Just look through it at your art and reference, and it will effectively remove the color information (except for the red, of course). You can get one of these nifty tools here.
Our brains will misinterpret color in a couple of ways. The first, much like value, is a mistake of comparison. A gray-blue next to a bright blue will just look gray. But put that same gray-blue next to a true gray, and it will look blue. The hue on the left in both stripes is the same color:
There are two techniques I use to overcome this. The first is the index card method. You will be comparing the color to a baseline white instead of the surrounding colors. The second is to use technology. Take a picture of your reference and open it in a photo-editing program like Photoshop or Affinity. Select the color using the color picker or dropper. You may be surprised at what color you find there. Make sure you do this several times in an area of color, however, as you may have chosen an aberrant pixel that doesn't represent the majority of the color in that area.
3. Shape and Size
The final optical illusion has to do with shape or size. This is probably more complicated than I will go into here, but the same principles apply. Shape and size are relative. Your brain compares and contrasts a shape, size, or angle with what's around it, sometimes giving you the wrong impression of what you're seeing.
The most helpful way I've found is to use a baseline measurement. Close one eye and hold up your pencil or paint brush handle at arms length: place your thumb to measure a part of the composition. Then compare that element to others. This will give you an idea of whether it's larger or smaller than the element you've already drawn. You can also use your pencil or brush handle to evaluate angles or determine how relatively straight or curved a line is. Comparing a curve to a straight pencil can tell you how not straight it actually is.
There are other tools to measure proportions and distances. If you tend to think in numbers, just use a ruler--I like the clear, plastic ones. If you're working from a photograph at 1:1 scale, just mark the length of the element on a scrap piece of paper and compare it to your drawing. If you're working from life or are reducing or enlarging a reference, a proportional divider is an more precise version of the thumb-on-your pencil method above. There are some great tutorials on YouTube on how to use them.
I hope this helped give some practical ways to overcome inaccuracies caused by optical illusions. Probably the most important advice I can give is to be patient and actually take the time to use these tools and methods. In the long run, it will save you time and frustration, and you'll hopefully get the results you're looking for.