Can Mehrunes Razor accidentally kill a follower?
Yes it is possible to proc on followers. So be careful.
https://www.reddit.com/r/skyrim/comments/5csfpo/if_you_have_a_follower_and_use_mehrunes_razor_be/
Specific to your scenario;
You cannot kill an essential character. Lydia can be essential or not, depending on your mods and console commands. You can "proc" her with the Razor, but she will only go into the crippled state. The Razor has an enchantment on it which, with certain unlocking mods, can be placed on other things. It's functionally like any other enchantment, which can harm an NPC but only kill if they aren't essential. There are also two characters in a DLC which have a specific immunity to the effect.
The only thing that can kill an essential character is a scripted event. The essential state of a character can also change, and often does once quests tied to them are complete, or if the quest requires you kill the essential character.