All the new semi- synthetic wood products, made from what would otherwise be waste, have their own gotchas, because they don't respond like real wood, in many ways. As you have discovered, MDF (I think the M is for 'medium') won't hold a screw driven into, or even near, an edge.
Luckily, the cheap furniture industry is way ahead of you. Go to an office supply superstore and examine their affordable furniture. You will find a number of variations on a camlock fastener that usually requires you to drive a double- headed screw into the real wood part, from the back, and drill a clearance hole for the screw, and a cross hole for the cam lock, in the MDF part. I swear I have seen the camlock assemblies for sale at home stores. They have to be available, somewhere, and inexpensive.
One other alternative is to homebrew your own, as with a machine screw driven into a large brass pin with a cross- tapped hole.
Or, cross drill where you're going to drive the woodscrew, drive it in, and fill the cross hole with JB Weld or other filled epoxy.
I've also found that it's sometimes sufficient, in low- load situations, to lubricate a woodscrew with a dab of carpenter's wood glue, which makes the screw easier to drive, and once it cures, much harder to remove.
;--
I had a cabinetmaker make a big box for me, of some composite stuff that had a hard syntheic core and two faces of multi- ply veneer. It was, as he claimed, waterproof and strong. But the first drawing I gave him came from a CAD model, and had decimal dimensions to two places, with very loose tolerances. When I'm working in CAD, I don't pay much attention to 'nominal' dimensions, I just make the parts fit each other, and I usually don't know how big they are until I dimension them.
He balked, so I marked up his print with nominal fractional dimensions and no tolerances, then went back and changed the CAD model to the fractional dimensions.
The finished box was exact to the stated dimensions within +/-.005" (~0.12mm) or so, and had no visible gaps or imperfections. I understand that cabinetmakers use knives to mark lines, and saw and drill to the middle of the line.
A carpenter, as opposed to a cabinetmaker, is a lot more sloppy, and may miss a dimension by the width of a carpenter's pencil (yes, the long way, 6mm or so). Of course, carpenters usually work in softwoods, which have hard striations that can cause a nail or a saw to drift off the intended mark, they typically work a lot faster than a cabinetmaker, and they have a specialist 'finish carpenter' clean up behind them, covering gaps and imperfections with precisely fit trim and moldings.
;--
If you're having trouble getting your drill to stay on the mark you want, start with a smaller drill, or stab the mark with an icepick.
-Mike-