First you have to understand that HE and AP shells work very differently against ship structures. HE primarily relies on blast effect as most of the energy of explosives are released into the air, whereas the numerous small shrapnel has little penetration against bulkheads. AP on the other hand has limited blast effect because not only the smaller weight of explosives but also the energy has been mostly consumed in breaking the shells apart. It primarily relies on fragmentation to inflict damage, as the shell being disintegrated into a few very large nose debris and numerous large fragments splashing side ways.
And don’t forget blast effect follows cubic inverse rules over distance.
AP fragmentation:
HE:
Spoiler

Real life examples:
50mm armour withstood British WW1 12" HE (48kg Lyddite) exploded about 3ft overhead:
Experiment on HMS Edinburgh (1882), where 1.5~2.5" protective deck withstood explosion of 13.5in HE (80.1kg Lyddite) in a confined space:
50~31mm deck stopped the blast effect and fragmentation (including the most destructive nose debris) of German AP shell:
Spoiler

76mm plate was not damaged at all by AP shell detonated in close vicinity:
Spoiler

AP shell blown up 25mm plate, fragments were stopped by 8mm non armour-grade steel:
Spoiler

British 15" Greenboy APC, blast effect did not crack or hole the 30mm deck overhead, and nose debris was deflected by 30mm bulkhead:
15" APC exploded in funnel uptakes and armour gratings, fragments did not penetrated 20mm bulkheads ahead and the 30mm deck below:
Experimental 15" SAPC (~40kg Shellite), explosion blown off local superstructure and deck, fragments and blast effect did not penetrate the 8mm roof overhead and the 8mm deck underneath:


















