JSFiddle - React, Tailwind, and code Playground

HTML

<div class="container">
  <div class="_center">Long text in middle</div>
  <div class="_end">right part</div>
</div>

CSS

.container {
  display: grid;
  grid-template-columns: minmax(0,1fr) 0;
  gap: 1rem;
}

._center {
  justify-self: center;
}

._end {
  justify-self: end;
  width: max-content;
}