Sure, but you need to somehow add in "Hunter's Mark" so it benefits from the ranger features.
I.e. can't break on concentration, advantage on the target, and improved damage dice.
Gloom Stalker's Mark
2nd level Illusion
Casting Time: 1 bonus action
Range: 90 feet
Target: A creature that you can see within range
Components: V
Duration: 1 hour
Classes: Ranger
You choose a creature you can see within range and mystically mark it as your quarry. Until the spell ends, the creature is under the
hunter's mark spell except the extra damage you deal is 1d8 necrotic damage. Also magical darkness spreads in a 5 foot radius centered on the target whenever you hit it with a weapon attack. The darkness last until the start of your next turn or until you end it as a reaction.
If the target drops to 0 hit points before this spell ends, you can use a bonus action on a subsequent turn of yours to mark a new creature.
At Higher Levels: When you cast this spell using a spell slot of 3rd or 4th level, you can maintain your Concentration on the spell for up to 8 hours. When you use a spell slot of 5th level or higher, you can maintain your Concentration on the spell for up to 24 hours.
Horizon Walker's Mark
5th level Conjuration
Casting Time: 1 bonus action
Range: 90 feet
Target: A creature that you can see within range
Components: V
Duration: 24 hours
Classes: Ranger
You choose a creature you can see within range and mystically mark it as your quarry. Until the spell ends, the creature is under the
hunter's mark spell except the extra damage you deal is 2d6 fire damage. Also whenever you hit it with a weapon attack. As a bonus action, you and up to four willing creatures are transported to unoccupied spaces within 30 feet of the marked quarry, regardless of what plane it is on, and the spell ends.