There are plants that deer don’t like to eat versus plants they like to eat… though a hungry or curious deer will try anything at least once or twice.
Go with 7 feet minimum. This is how tall a fence needs to be to keep deer from jumping over the top.
If you only need to protect a few vegetable beds or specific plants, it may be easier to enclose those plants individually with cloches, cages, netting, or other physical barriers.
Many of them include active ingredients like cinnamon, clove, or mint in their formulas (scents that deer dislike) and are harmless to wildlife, pets, and children.
Encouraging deer to come around your yard can also be unsafe for your pets. Though deer are generally very timid and gentle, they’ve been known to attack dogs if they feel threatened or want to protect their young.