Opinions vary.
My wife has a difference in leg length, and at one time (nearly 40 years ago now) she used built-up insoles in one shoe following advice from a physiotherapist.
Same physiopherapist advised a higher pedal cage on one side, and advised not to use different crank lengths. Which were easily available at the time in the TA "Cyclotouriste" range, it was possible to buy single cranks from 150 to 185 mm in 2.5 mm increments.
Special pedal cages were available on the very nice but very expensive pedals sold by TA Spécialités at the time, with a variety of height differences proposed.
I did the job on the cheap using bits of scrap aluminium window frame from the place were I worked at the time, securing the extra material to her existing pedal with pop rivets and bolts.
After a number of years, my wife stopped using the insoles because she believed it made no difference, and I eventually removed the extra material from the modified pedal.
More recently, she again has custom insoles to use in BOTH shoes, but I didn't modify the pedals as she uses shoes with the custom insoles when riding her bikes. This was also true when I modified one of her pedals, but neither the physiotherapist nor myself realised this simple fact!
The big difference for my wife (who is much shorter than I am) was when I changed her cranks from standard (170 or 165 mm) to as short as I could find (150 mm TA "Cyclotouriste").
Despite being fairly tall, short cranks also suit me better, as I found out when I had a spare pair of 150 mm cranks available from either my wife's bike or one of my daughters' bikes when I was building up a bike for myself. I put them on as a temporary fix and liked the change so much that I converted all my bikes to 150 or 155 mm as available.