For games that switch resolutions, like many Sega ones, notice that in most cases the vertical resolution doesn't change, so a good approach is to use an integer multiple of both horizontal resolutions in use, e.g. for 256x and 320x, create 1280x224 with your custom resolution tool, then run MAME like this:
mame tantr -switchres -r 1280x224 -noues
Here -noues (-nounevenstrech) makes MAME use integer scaling, which will seamlessly scale the picture with the proper factors.
Another method is to use "super" resolutions. You simply define a superwide resolution with the proper height, like 2560x224, then run MAME like this:
mame tantr -switchres -r 2560x224 -uesx
The difference here is that you use -uesx (-unevenstretchx), which applies fractional scaling on the horizontal axis, and integer on the vertical. Because the resolution is so wide, all horizontal resolutions will stretch nicely without visible artifacts, while not messing your scanlines.