A test statistic is a function of observable random variables whose distribution does not depend on any unknown parameters. For example, if n is large enough, then the central limit theorem says that the normal distribution with mean zero and variance one is approximately valid for the test statistic:
$$
T=\frac{\bar{X}_n-\mu}{\sigma/\sqrt{n}},
$$
Clearly the test statistic involves unknown parameters. Generally, the inference question in this setting is to test whether or not the population mean, $\mu$, is equal to some value, say $\mu_0$, where $\mu_0$ is known (the test will decide whether or not it is really $\mu_0$). The standard error, $\sigma$, must be estimated. But, the null distribution of the test statistic is N(0,1), which, importantly, does not have any unknown parameters.
Many authors consider significance testing to be the same as hypothesis testing, which perhaps leads to confusion on this point. In hypothesis testing, the size of the test is determined a priori, which means the distribution of the test statistic must be estimable a priori, and hence must not have any unknown parameters. That is, before obtaining data and estimating $\bar{X}_n$ and $\mbox{se}(\bar{X}_n)=\sigma/\sqrt{n}$, the size of the test should be calculable. Here, the size of the test is the probability of making a type I error. More precisely, it is the supremum of the power of the test under the null hypothesis; where the power is the probability of rejecting the null hypothesis under a given parameter(s).
In significance testing, a p-value is determined a posteriori. The p-value is the probability of observing a test statistic "at least as large" as the one observed, based on a null distribution. It was not intended to be used in a hypothesis-test setting. One problem with doing so (e.g., rejecting the null hypothesis if the p-value is < alpha) is that there are different ways to calculate the p-value that can change the result depending on the type of test and the experiment conducted. See Goodman (1999, Ann Intern Med, vol. 130, pp. 995 - 1004) for a good discussion about the differences between the two testing procedures. Also, see the ASA's statement on p-values (2016, https://doi.org/10.1080/00031305.2016.1154108).
In the p-value/significance testing setting, it maybe is not important to have a sample statistic (i.e., $\bar{X}_n$ is a sample statistic because it is a function of observable random variables) have a distribution that is free of unknown parameters because it is calculated after observing the data without controlling for the size of the test.
In summary, a statistic like $\bar{X}_n$ is a sample statistic. Strictly speaking, it is not a test statistic because its distribution, say $N(\mu,\sigma^2)$, depends on unknown parameters. The size, and power, of a hypothesis cannot be regulated a priori with these nuisance parameters. But, authors who consider the two types of testing to be the same maybe do not worry about controlling for the size of the test. In their setting, a sample statistic would be the same as a test statistic. The statistic $(\bar{X}_n-\mu)/\mbox{se}(\bar{X}_n)$ is a test statistic because its distribution, $N(0,1)$, does not depend on unknown parameters, they are zero and one, resp.