Gap for layoff or fill with irrelevant job?

Is it better to leave a gap for layoff period or put in a irrelevant role that you've been doing in between? I was hit by layoff middle of last year. The job I've been working between the layoff and now is an AI sec role that has nothing to do with app sec eng. I feel that I'm not getting interviews due to companies are looking away when they see the current irrelevant AI sec role.

VMware TPIR Feb 6

I don't think an AI sec role is irrelevant, in fact is very relevant. What kinds of companies are you applying to? These roles tend to be available in big enterprises and not in your run-of-the-mill companies