My Samsung Galaxy Tab A SM-T385 keeps turning off and on itself. It's stuck in a some kind of loop I guess. I've tried draining out the battery and restarting it, still the same result. When I try to open the safe mode, a blue screen shows up saying "NO COMMAND". It keeps vibrating and showing the "Samsung" Logo.
Try holding down the Volume Down button and power on. That should present you with a menu of recovery options, all the way down to Factory Reset which would wipe out all your personal data.
You make your choice by using the volume up and down to scroll to that choice then press the power button to start it off.
When I do that, it shows "WARNING A custom OS can cause critical problems in device and installed applications" and asks if I want to continue or not
Did you install this custom OS yourself or did someone install it for you? No matter who did, if it was installed to add features that your original OS didn't have, those features would be gone when you reset the device. If it allows you to reset it. Sometimes it won't work when an alternate OS is installed.
Any changes to the device, including installed apps, contacts, files, photos, music, etc. will all be gone if the tablet is reset. Also, since you can't even get into "Safe Mode" then I am quite certain the device has been altered. There are programs that can restore it to its original OS. Usually they work, but not always.
To follow webworkings'advice, I believe www.xdadevelopers.com is going to be your best friend if you wanted to investigate Yaffs.
First though, you would have to back to that stage where you had the Custom operating system warning, ignore it and continue to Factory Reset. As has been said, you'll lose everything but you get back a working tablet.