I have a Canon EOS 5D can I use the Speedlite 540ez or the 550ez with it, either auto or manual
The 160E, 200E, and 300EZ from the same era as your 540EZ will only work in full power mode on digital EOS bodies, including your Canon EOS 5D. There's no way to control them manually and they will not work in E-TTL mode. The E/EZ series of flashes are TTL and A-TTL compatible, but not E-TTL compatible.
TTL and A-TTL are dependent upon a metering sensor in the floor of the camera's light box¹ that measures the reflectance of light off the film during the actual exposure and quenched the flash at the appropriate time.
When E-TTL, which uses the camera's main exposure meter located in the prism/viewfinder area to measure a low power pre-flash before the shutter opens to begin exposure, was introduced existing film cameras were equipped with both types of sensors and could use either system: A-TTL or E-TTL.
Canon digital EOS bodies are all E-TTL with no floor sensor to support TTL or A-TTL. Digital sensors are highly reflective when compared to film. Because of the higher reflectivity, A-TTL would still be problematic even if digital cameras did have the required sensor. So the only thing you can use the lower end E/EZ series flashes for with a digital body is a full power dump.
However, 400-series and 500-series EZ flashes have manual power controls. Your 540EZ does have manual controls and can be only be used in manual power mode with Canon digital EOS bodies. It's pretty much like any other generic non E-TTL flash when used on an EOS digital camera.
I've never heard of the 550EZ. Do you mean a 550EX? If so, it should work as designed with all of its included features when used with EOS digital camera bodies. That does not mean all of the E-TTL flash features for which your EOS body is capable are included in the 550EX, though.
I think this page says it all:
The 540EZ will not support E-TTL, and thus won't work on digital EOS cameras for automatic flash exposure.
If you want to use it in manual mode, the flash will probably work because 5D doesn't have a crippled hot shoe. But, whenever I'm using an on-camera flash instead of using it off-camera, I'm usually shooting something that happens quickly, and therefore, absolutely need the E-TTL auto-flash-exposure. I would find it very limiting to use only manual mode.
So, my recommendation is to look for the Canon EX flashes. There may be some pretty good deals if you don't want the latest and greatest, but instead choose some used flash at a fraction of the price of a new.