So you're asking for 6w. that's kind of a lot when you also want 40v..300v dc input, to a low output voltage.
You should check if you can use a relay rated for higher voltage. I don't know what kind of relay you need, but if they're generic general purpose ones, then you will easily find 36v or 48v relays.
Most 36v relays will trigger from around 27v and the 48v ones will turn on at 33v or more.
You could use a switching regulator IC like LTC7138 .. it's 40v .. 140v input and can do 36v up to 0.4A (varies with input, min 120mA with 40v input)
They're kinda expensive at 8$ a piece for the LTC7138 but if you don't need isolation, these can save you custom transformers, the datasheet even has an example circuit :

A 36v or 48v relay will only use around 10mA, so you'd be left with around 3w for your logic... if you can optimize the power consumption on the rest (maybe use a bunch of capacitors to handle bursts of power consumption if the idle consumption is low)
36v to 3.3v..5v for your logic can be done with any 0.5$ switching regulator.
So you could have a DC in jack for 40v.. 120v DC which goes to your swiching regulator, and you could have a second 100v ... 300v DC / 80v .. 260v AC input that could go to any generic ac to 36v / 48v dc adapter.... or a ac/dc converter like Recom RAC20-K series :
https://www.recom-power.com/pdf/Powerline_AC-DC/RAC20-K.pdfA potential workaround for having a second high voltage psu could be this, if you get get the total power below around 2.5..2.8w
There are linear regulators like LR8K4 which can work with up to 440v DC and will output up to 20mA and (Vin-12v) output voltage. So you could set the output to 140v and the regulator will regulate and output up to 20mA ... that's 140v x 0.02 = 2.8 watts. With 300v in, you'll dissipate around 3.5w in heat ... which isn't a huge amount for a linear regulator, cooling is doable.
Link to regulator:
https://uk.farnell.com/microchip/lr8k4-g/linear-volt-reg-0-02a-440v-to/dp/2448524