Yes, it's fine to use Epsom salt when you want to give either of these two types of plants a real boost.
When you apply it, make sure you don't get any on the leaves, otherwise they'll have a hard time absorbing nutrients from it. The reason why we use Epsom salt is that it's a good soil conditioner. It helps the soil hold moisture longer and also holds in more nutrients (nitrogen).
Epsom salt is a natural mineral-rich salt. It can be used to help keep cucumbers and other vegetables fresh. To keep cucumbers fresh, sprinkle them with salt and place them in a plastic bag or container with holes punched in the top. The salt will draw moisture from the cucumbers' leaves, and prevent them from wilting.