Barre chords are the bete noire of guitar playing! It usually takes a fair bit of effort to get all six strings sounding out cleanly, so it's no surprise you're struggling.
Several factors are important, not least having your guitar in a state where barre chords can actually be played comfortably. This involves having an action that's not too high, and strings (initially at least) not too tight due to a heavy guage. If those are not right, it can be almost impossible to barre chords well.
The barre finger - most often the index - does not need to be pressing all of the six strings at the same time. Think about it, there's often three strings (5, 4 and 3) that are pressed down with other fingers when playing an E shape. So, taking that as our start point, the index finger only needs to press 6, 2 and 1.
Use the side rather than the pad of that finger, and make sure that none of those 3 strings is under the joint part of said finger. Easy enough to find a good position, higher or lower on the fretboard, with no other fingers on. Start around fret 6 or 7, as it's easier there than lower or higher along the neck.
Use your elbow as a lever, and the index finger as the fulcrum point to apply pressure, rather than your thumb behind the neck. It's actually quite possible to play a good barre chord with no thumb on the back, so don't rely on that too much.
Experiment with neck angle, both from a bird's eye view and how high or low the head of the guitar is,, as well as how high or low your guitar is slung. All of which will contribute to the ease of barre playing.