Get selected string from TextMeshPro input field/text on Android

i am trying to create a tag system for a journal i’m making and that requires being able to select specific parts from either an input field or a text element with the finger (drag and select) and then save that selection into a list.

The issue is i don’t know how to do it! i did some google research in terms of "saving selected text from input fields" and similar searches but i couldn’t find something to help me out.

The flow should be : user types something like "hello world" , then he drags his finger on the screen highlighting the word "World" and once highlighted it is saved into an empty string which then i can add to the list i want.

Can i get some help or recommendations on what to read to make it happen? Thank you!