Intracellular transport in living cells is often spatially inhomogeneous with an accelerated effective diffusion close to the cell membrane and a ballistic motion away from the centrosome due to active transport along actin filaments and microtubules, respectively. Recently it was reported that the mean first passage time (MFPT) for transport to a specific area on the cell membrane is minimal for an optimal actin cortex width. In this paper, we ask whether this optimization in a two-compartment domain can also be achieved by passive Brownian particles. We consider a Brownian motion with different diffusion constants in the two shells and a potential barrier between the two, and we investigate the narrow escape problem by calculating the MFPT for Brownian particles to reach a small window on the external boundary. In two and three dimensions, we derive asymptotic expressions for the MFPT in the thin cortex and small escape region limits confirmed by numerical calculations of the MFPT using the finite-element method and stochastic simulations. From this analytical and numeric analysis, we finally extract the dependence of the MFPT on the ratio of diffusion constants, the potential barrier height, and the width of the outer shell. The first two are monotonous, whereas the last one may have a minimum for a sufficiently attractive cortex, for which we propose an analytical expression of the potential barrier height matching very well the numerical predictions.