There was a great fuss in England language circles in earlier years about putting prepositions at the end of sentences. Lots of academic types, who had been educated in the rules of Latin, disapproved.
Winston Churchill once allegedly exclaimed, "That is the sort of thing up with which I will not put!" to mock someone who criticized him for ending a sentence with a preposition.
This pseudo rule has long since been dumped in the dustbin. The guideline that remains is to construct sentences that are idiomatic, regardless of the placing of the preposition.
In both your examples, the preposition fits much more comfortably after the verb that precedes it. To place the preposition at the end makes for a clumsy, awkward sentence.
Prepositions sometimes get lost at the end of sentences:
Who did you wait on the street that leads down to the church with the bell tower for?
However, there are dozens of examples where this is not the case and it's much easier to place the preposition at the end.
Who did you spend the morning with? sounds more natural than With who/m did you spend the day?
https://grammar.yourdictionary.com/parts-of-speech/prepositions/ending-a-sentence-with-a-preposition.html