Would one technology have an advantage over the other? Leaving outside other parameters like the earbuds fitting in your ears or achieving an optimal seal
Both have advantages and disadvantages. IEMs block outside sounds more effectively than headphones (especially open-backed headphones), and tend to be able to provide more accurate frequency response and low distortion at a reasonable price. However, some people find them uncomfortable, and because they're inserted into your ears, they don't provide the same kind of imaging and soundstage as headphones.
Headphones are often harder to drive, and especially on a budget, less accurate, but some people find them more comfortable, they're more suitable for certain uses (for example, sharing with other listeners, or using in a recording studio environment), and they will generally provide better imaging and sound stage.
But these are, of course, just generalities, and will vary based on the device and the listener.
If you want to compare a good set of headphones and a good set of IEMs without breaking the bank, check out the Truthear x Crinacle Zeros which were recently reviewed by Amir. They're $50 USD and they sound incredible. For headphones, AKG's K371 can often be found for well under $150 and provide very balanced sound and decent comfort. A good reasonably priced headphone amp/DAC that will help them sound their best and fits within that price range as well is the Topping DX3 Pro+.
[edit] As an example - I have a set of the Truthear IEMs, as well as a pair of AKG K702 headphones. The Truthear IEMs are unquestionably more accurate even though they cost 1/5th what the AKGs did; however, the AKGs, despite having a less balanced frequency response, have a very wide, open soundstage that makes it feel like the music is all around you when you're listening to a good recording, whereas listening to the Truthears, it just sounds like the music is inside your head. If I'm sitting down on a quiet night at home to listen to music, I definitely reach for the AKGs over the Truthears, but I've been listening with the Truthears a lot when working out, walking, or just using my computer or doing other things. Advantages and disadvantages to both.