The order I would use:
- Photograph everything before touching anything. Both bikes, both locks, the railing, the surroundings, timestamps. This is your evidence if any of it becomes a dispute.
- Leave a note with a phone number on the other bike, and wait a while if you can. A large fraction of these resolve in twenty minutes with an embarrassed apology.
- Report it to the police or, if you are on private land, to the building or business. A report before you cut anything is what separates you from someone stealing a bike.
- Get the other bike's details recorded — frame number if visible, description — and check whether it has been reported stolen. If it has, this becomes a very different conversation and not one for you to resolve.
- Only then consider cutting, and cut your own lock rather than theirs. Yours is your property and destroying it raises no questions at all.
That last point is the one people get wrong. Cutting someone else's lock, even to free your own bike, puts you in a bad position.