Have you heard of mimicry?
Mimicry, in biology, means the close external resemblance of an animal or plant (or part of one) to another animal, plant, or inanimate object.
Mimicry happens constantly. Some of the most common mimicry exists in the always-frustrating world of "yellow stripey things," for which you can find many memes and charts, like the one below that I found in the Reddit archives (author unknown):
I certainly wouldn't call it comprehensive, and I don't care for calling insects aggressive (come on, they are tiny, we are huge - it's defensive behavior), but I think the blurbs are amusing. It does show some very good examples of how things that are closely related (all but the one in the top right are order Hymenoptera - they are all bees and wasps) can look similar, but it's that one in the top right corner that matters in this conversation - that is a hoverfly, which is a fly (order Diptera) that looks like a bee.
There are many animals -- flies, beetles, moths, and more -- that are have black and yellow stripes but are completely harmless. I won't get into how this happens from an evolutionary point of view, but I will say that you are meant to think that everything with black and yellow stripes is a bee, that's why they have the coloration that they do.
But this is getting a bit deeper than I intended. All I really want to say is that you need to look at something black and yellow a bit more closely in order to determine if it is actually (potentially) venomous and even then, it doesn't really tell you whether it is something to fear (it usually isn't - unless you have an allergy). So, I want to explain how to tell the difference between a bee and a fly, because it isn't always very easy. I can 100% guarantee that at least 20% of the 'bees' you have run away from in your life are actually hoverflies, which are super important pollinators and completely harmless.
Look at this photograph, can you tell if they are bees / wasps or flies?
Believe it or not, every last one of those is a fly - all are known as flower flies. Mind blowing, right? Some of those look very much like bees!
So, then how do you tell the difference?
So how can you tell? What are the things you need to look for? Here's a summary of the most important characters to check to determine if you have a bee or a fly.
The first thing I check is always the eyes.
Bees have smaller, oval- or kidney bean-shaped eyes that are on the sides of their head. See how far apart and kidney bean-shaped the eyes are on the sweat bee below.
Flies have huge, round eyes that tend to make up most of the head. Look at how huge and round the eyes are on this horsefly.
The second thing I look at is the antennae.
Bees (photograph below is a cuckoo wasp, but wasps and bees share this character) have long elbowed antennae which have a joint where it bends in the middle.
Flies have short, stubby, hair-thin antennae - these are called 'aristate' antennae. They are sometimes longer but in most flies this is a good thing to check. The hair on the antennae of the feather-legged fly below are almost invisible they are so tiny.
There are several characters to look at with the body itself, but the most important is usually the amount of hair that is present.
Bees are rather fuzzy and some can have a good deal of hair, like bumble bees. Many bees have especially hairy legs, which they use for carrying pollen back to their nests or brood chambers. Because bees have so much hair on their bodies, they also tend to have pollen stuck to them in places other than they legs. You can see the pollen-covered bumble bee butt below.
Flies tend to have individual hairs coming out in discrete locations, if they have any hair at all, and they don't have the hairy legs for transporting pollen. The long-legged fly below does have hair, but you wouldn't call it fluffy or furry - they are in discrete little dots.
Not always easy to see, hence why it's the last character that I use.
Bees have two sets of wings - so four wings in total. In the photo below you can see I'm pointing to two wings that are both on the same side of the bumblebee, so it has four in total.
Flies have one set of wings - so two wings in total. You can see both wings below on the bee fly.
Overall, it just takes some practice and you will be able to tell whether you're looking at a bee or a fly. If you would like to give yourself a little quick, click the link below and see how good you are!