It is not always wrong to end a sentence with a preposition. At times, the preposition needs to be at the end of a sentence, especially when the alternative of not ending with a preposition causes confusion or affects the meaning of the sentence. However, it should be avoided whenever it is possible to rewrite the sentence in order to convey a clear meaning.
The following sentences ending with a preposition are acceptable.
It is a trivial matter that is not worth arguing about.
With her new family, she is being well looked after.
Which size are you looking for?
The search party wanted to know which entrance to the cave he went in.
He is not someone you will want to talk to.
He is my only friend whom I often go out with.
The following sentences ending in a preposition are acceptable but can be avoided.
The visiting team is difficult to play against.
It is difficult to play against the visiting team.