I am still exploring Stand and tried to fit a uniform distribution to some synthetic data (see code below), however Stan complains about divergencies and the posteriors look odd to me:

Probably use a (positive_)ordered type for the parameters, and try without hard constraints (put weakly informative normals on each element of the ordered vector).

I think you are getting divergent transitions because the sampler steps into a part of parameter space that makes the likelihood invalid, which is where the lower bound is greater than the minimum of the data, and/or the upper bound is smaller than the maximum of the data. The following Stan program seems to work fine and reports no divergent transitions.

data {
int<lower=0> N;
vector[N] y;
real y_min;
real y_max;
}
parameters {
real <upper = y_min> alpha;
real <lower = y_max> beta;
}
model {
alpha ~ normal(0.8, 1) T[, y_min];
beta ~ normal(1.2, 1) T[y_max, ];
y ~ uniform(alpha, beta);
}

where min_y and max_y are fairly self explanatory, and could be found in the transformed data block instead of externally.

I donâ€™t know if there is a sensible way to incorporate measurement error into this kind of model. You want to do something like this:

data {
int <lower = 0> N;
vector [N] y_obs;
}
parameters {
vector <lower = 0> [N] y;
real <lower = 0> sigma;
real <upper = min(y)> alpha;
real <lower = max(y)> beta;
}
model {
y_obs ~ normal(y, sigma);
y ~ uniform(alpha, beta);
sigma ~ normal(0, 1);
alpha ~ normal(0.8, 1);
beta ~ normal(1.2, 1);
}

but this model probably needs some kind of complicated Jacobian adjustment to account for the varying support of alpha and beta. Additionally, I would suspect the use of min and max might introduce a non differentiable point into the posterior, which is problematic. I also think that this model is likely to be unidentifiable because of the strange way sigma / alpha / beta interact. Simulating data from this model and trying to estimate the simulated parameters with Stan demonstrates these problems.