For pure bending panel/shell structures and for panel/shell structures sized by in-plane compression or shear buckling, sandwich is almost always is the most efficient design.
It is rarely used these days for aerospace external panels because of maintenance worries. However, it almost always results in the lightest AND cheapest design for hand laid panels. If automatic tape laying is used then sandwich can be a bit more expensive, as typically only one face can be tape laid.
The maintenance issues are because with honeycomb a lot of moisture ingress is possible. Freeze-thaw and chemistry can then damage the panel badly. With the all-aluminium honeycomb sandwich design for Boeing "fore-flaps" and DAC "flap vanes" (the smaller airfoils in front of the main flaps), moisture ingress used to result in complete loss of the part distressingly frequently. Concorde rudders were also honeycomb sandwich and suffered from in-service failures. However, numerous other sandwich structures survived long lives with negligible trouble. For instance, the whole wing covers of the Beech Starship biz "jet prop" were sandwich; as far as I'm aware they never gave any trouble. Biz jet fuselages are often sandwich as well.
(Honeycomb, especially metal honeycomb, is almost always a bit lighter and cheaper than good foam, though lower temperature foam such as polyurethane can be cheaper. If the application is sufficiently undemanding then PVC or similar can be used. This is common with kayaks and the like, where the increased impact tolerance of flexible foam is also of benefit.)
Even with a good closed-cell foam, moisture ingress can be a problem after delamination due to impact.
Then, because sandwich design essentially divides the skin into two surfaces, plus the efficieny gains thinning the skins even more, the external surface can be very vulnerable to impacts. The sandwich can be made asymmetric, with the external skin nice and thick, but this trades off some of the efficiency gains from being sandwich.
Analysis of sandwich is complicated by various local buckling modes, though it's arguably no more complicated than a stiffened panel, and is much easier to size.
Further complications with sandwich are how to achieve 'point' contacts for fittings, etc. A block of heavy core or resin can be inserted, or a "pan-down" design can be used and attachment made to a locally increased thickness of single skin.