Your example is correct but I'm not sure that it helps to make the meaning of "transitive" and "intransitive" clear.
A transitive verb is a verb that takes an object. The verb acts on something. An intransitive verb does not take an object.
For example, "Bob bought a car." The verb is "bought". It takes an object, "a car". What did Bob buy? He bought a car.
With some verbs, it doesn't make sense to have an object. The verb doesn't act on any particular object. It just happens. Like, "Bob slept." What is the object of "slept"? There is none. He didn't sleep something. The sleep didn't act on anything. He just slept.
Sometimes a verb can take an object but it doesn't have to. Like I could say, "Bob sang a love song." What did he sing? A love song. But I could also just say, "Bob sang." I don't specify what he sang.
In your first example, "We distinguish an apple from a pear", "distinguish" is acting on something. What do we distinguish? We distinguish an apple. In real life if I just said, "We distinguish an apple", that prompts the question, "Distinguish an apple from what?", so we need to add some words to say what we are distinguishing it from. But that's not required by the grammar, that's required by the meaning of the word "distinguish". And technically, it can be valid to just end with the object. Like if the eye doctor said, "Can you read this eye chart?", you might answer, "I can distinguish an 'R'." In that case you mean, you can see that there is an 'R', without regard to what it is not.
In your second example, "distinguish between an apple and a pear", the verb is not taking an object. Rather, we are using a prepositional phrase to say what the two things are that we are distinguishing. The practical meaning is the same as the first example, it's just different grammar to express the same idea.