Hello,
Welcome to the forum ! We hope you enjoy your time here, and find this to be a friendly and helpful place.
Once the kernel panics, the system along with all its services is effectively down, and the only way anything starts back up is by rebooting the system. There is no way of performing a controlled shutdown of services when the kernel panics: they simply stop running instantly, because there is no longer any functional operating system for them to run under.
Generally speaking, you normally don't need to worry about going out of your way to make a particular service detect kernel panics. When these happen every service will fail, along with everything else on the system - without a functioning kernel, there can be no functioning services. However every service which is set to start on boot will then start normally again when the system reboots to recover from the panic, thus restoring normal operation.
Now, if what you're asking is if there's a way to make a service only start on normal boots but not on reboots after a kernel panic, then I think you're into trickier territory. However, one thing worth considering is whether you normally want the service to automatically start on a regular boot, or would you only ever want it to be started manually ? Because if you actually don't want it auto-starting ever, then the easiest thing for you to do here is to disable the service, which will prevent it from starting on any kind of boot. You will still be able to manually stop and start the disabled service yourself, however. That way you would always directly be in full control of when (and if) the service should start, as you would have to log in to stop or start it.
If you really are for some reason wanting a service to specifically not auto-start on boot if and only if the system is recovering from a kernel panic, then you'd probably have to handle the logic for that yourself, and it wouldn't be straightforward. By definition, since the crash occurred due to a failure of the kernel, you don't normally see in the regular syslogs any information about the nature of the crash. You just see the system running apparently normally, and then suddenly booting again without any previous reboot or shutdown. The best you can hope for is that a kernel dump exists recording the crash if you want more info on what happened after the fact, but that will only exist if your system is configured to support such behaviour.
Systems which take kernel dumps in the event of a kernel panic normally do so by transferring control to a secondary capture kernel which exists in a reserved area of memory, and which then has the sole purpose of recording as much information regarding the now-dead main kernel as it can before initiating a reboot. So you could maybe incorporate some kind of logic into the startup script for your service to search for such dumps and react differently if any exist in a timeframe immediately prior to the current boot, but that may not be as reliable (or as easy) as you might want.
Anyway, hope this helps ! If I've mis-understood anything here or if you have any further questions then please do get back to us again and we can take things from there.