I cannot give a correct answer as I am unable to fully understand your question. But lets assume, you want to have some part of your stated xpath as a variable, that part can be stored in a variable and then referenced in your function call.
And my_variable can be controlled in your code and change value as needed without writing complete xpath
Again having said that, more clarity on your question will help the community help you bette
my_variable = 'SomeData'
browser.find_element_by_xpath(f'//div[contains(text(), "{my_variable}")]')
if you are using python version less that 3.6
my_variable = 'SomeData'
browser.find_element_by_xpath(f'//div[contains(text(), "{my_variable}")]'.format(my_variable=my_variable))
or syntax provided in the comment by Andersson