The thing to understand about delta functions is that they are essentially shorthand for a recipe. When we write
$$\int_\mathbb R f(x) \delta(x-y) \mathrm dx = f(y)$$
we should understand this as being true by definition; we don't actually perform the integral on the left-hand side, because $\delta$ isn't really a function. In that sense it is a convenient shorthand for the recipe "evaluate the function $f$ at the point $y$."
On the other hand, you may have seen$^\dagger$ that the delta function can be understood in some sense as the limit of a sequence of e.g. normalized gaussians of decreasing width and increasing height. Letting $g_\epsilon(x):= \frac{1}{\epsilon\sqrt{2\pi }}
e^{-x^2/2\epsilon^2}$, one sometimes says that
$$\delta(x-y) \overset{?}{:=}\lim_{\epsilon\rightarrow 0} g_\epsilon(x-y) \qquad (\star)$$
On its face, this doesn't make much sense, since this limit obviously fails to exist when the argument of $g_\epsilon$ is equal to zero. However, we define it via integration against a so-called test function. We first consider a vector space of "well-behaved" functions $\mathscr F$; for example, $\mathscr F$ is commonly taken to be the space of all smooth functions with compact support. From there, we can understand the aforementioned definition as follows:
$$\int_\mathbb R f(x) \delta(x-y)\mathrm dx := \lim_{\epsilon \rightarrow 0} \int_{\mathbb R} f(x) g_\epsilon(x-y) \mathrm dx$$
Note the subtle trickery here - we've moved the limit outside of the integral. In other words, the limit in $(\star)$ is to be understood as being taken only after integration against a suitable test function. The limit doesn’t define a function, but rather a procedure.
If the delta function is constructed in this way, the extension to a compact interval is immediate; we simply have that
$$ \int_a^b f(x) \delta(x-y) \mathrm dx := \lim_{\epsilon \rightarrow 0}\int_a^b f(x) g_\epsilon(x-y) \mathrm dx = \begin{cases}f(y) & y\in(a,b)\\\frac{1}{2}f(y) & y\in\{a,b\} \\ 0& \text{else}\end{cases} \qquad (\star\star)$$
where the factor of $1/2$ at the endpoints is due to the fact that only half of the normalized Gaussian $g_\epsilon$ is inside the interval $[a,b]$.
This brings us to the derivative of the delta function. We can proceed as before, defining
$$\int_{\mathbb R} f(x) \delta'(x-y)\mathrm dx := \lim_{\epsilon\rightarrow 0} \int_\mathbb R f(x) g'_\epsilon(x-y) \mathrm dx \overset{IBP}{=} -\lim_{\epsilon\rightarrow 0} \int_\mathbb R f'(x) g_\epsilon(x-y)\mathrm dx$$
$$= -\int_\mathbb R f'(x)\delta(x-y)\mathrm dx$$
However, when we now attempt to restrict to the compact interval, we have a problem; because the boundary terms appear, we instead find
$$\int_a^b f(x) \delta'(x-y)\mathrm dy = \lim_{\epsilon\rightarrow 0} \bigg[ f(x) g_{\epsilon}(x-y)\bigg]^b_{x=a} - \int_a^b f'(x)\delta(x-y) \mathrm dx$$
If $y\in\{a,b\}$, then the limit of the boundary term diverges unless $f$ vanishes. As a result, the only way to use this construction to define something like
$$\int_a^b f(x) \delta'(x-a)\mathrm dx$$
is to restrict the set of test functions to those which vanish at $a$.
In summary, $\int_\mathbb R f(x) \delta(x-y)\mathrm dx$ and $\int_\mathbb R f(x) \delta'(x-y) \mathrm dx$ should be understood as shorthand for the recipes "evaluate $f$ at $y$" and "evaluate $-f'$ at $y$," respectively. Although $\delta$ is not a function in its own right, it can be understood as the limit of a sequence of functions $g_\epsilon$ where the limit is to be taken after integration against a suitable test function, where the latter is chosen specifically to make the aforementioned limit well-defined.
When we restrict the integration to a compact interval, we don't run into any problems unless the argument of $\delta'$ vanishes at one of the endpoints. If this happens, we need to choose the space of test functions to vanish at the problematic endpoint; otherwise the limit doesn't exist, and the "recipe" is nonsensical.
Note finally that we don't actually need to construct the recipe by taking a limit of some $g_\epsilon$'s; we might simply define the recipe all by itself as e.g.
$$\int_a^b f(x) \delta'(x-y) := \begin{cases}-f'(y) & y\in(a,b)\\-\frac{1}{2}f'(y) & y\in\{a,b\} \\ 0& \text{else}\end{cases}$$
Of course, if we do this then it renders the answer to this question somewhat trivial.
$^\dagger$As per Ruslan's comment, we sometimes call the $g_\epsilon$'s nascent delta functions. It is not necessary to use a Gaussian - any sufficiently well-behaved, normalized functions would do. However, the details of the $g_\epsilon$'s may have an impact on some subsequent properties e.g. the factor $1/2$ in $(\star\star)$.